简体   繁体   English

D3.js:力导向图,边长与边权重成正比

[英]D3.js: Force-directed graph, edge length proportional to edge weight

I have a complete, undirected, weighted graph. 我有一个完整的,无向的加权图。 I would like to visualize this graph in such a way that the visualized edge lengths are proportional to the edge weights, which represent distances between locations (the nodes). 我想以可视化的边缘长度与边缘权重成比例的方式来可视化该图,该权重表示位置(节点)之间的距离。

My understanding of the force-directed graph model is that the node charge determines the distance between the nodes, and thus the edge length. 我对力方向图模型的理解是,节点电荷决定了节点之间的距离,从而决定了边长。 Since no node can have more than one charge, it seems logical that (for the complete graph), the distance between all nodes adjacent to some node must be the same. 由于没有一个节点可以有一个以上的电荷,因此(对于完整图形)逻辑上,与某个节点相邻的所有节点之间的距离必须相同是合乎逻辑的。

Is there a way to accomplish such a visualization of a complete graph in D3.js? 有没有办法在D3.js中完成这样一个完整图形的可视化?

不能。您可以为每个边缘设置linkDistance() ,但这实际上只是一个准则-D3并没有严格要求该长度。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM