如何指定Cytoscape.js中节点之间的链接距离?

问题描述:

我是Cytoscape.js的新手,所以我可能会丢失一些明显的...如何指定Cytoscape.js中节点之间的链接距离?

我知道如何在D3.js中做到这一点,但需要更多的权力来显示大量节点的聚类(> 1,000)并且不需要可视化链接。

在此先感谢指着我在正确的方向...

原来我一直在寻找在文档的WebCola,不Cytoscape.js :-)

elements: { 
     nodes: [ 
     { data: { id: 'a' } }, 
     { data: { id: 'b' } }, 
     { data: { id: 'c' } }, 
     { data: { id: 'd' } }, 
     { data: { id: 'e' } } 
     ], 

     edges: [ 
     { data: { id: 'ae', weight: 1, source: 'a', target: 'e' } }, 
     { data: { id: 'ab', weight: 3, source: 'a', target: 'b' } }, 
     { data: { id: 'be', weight: 4, source: 'b', target: 'e' } }, 
     { data: { id: 'bc', weight: 5, source: 'b', target: 'c' } }, 
     { data: { id: 'ce', weight: 6, source: 'c', target: 'e' } }, 
     { data: { id: 'cd', weight: 2, source: 'c', target: 'd' } }, 
     { data: { id: 'de', weight: 7, source: 'd', target: 'e' } } 
     ] 
    } 
+0

所以,我假设我可以将距离度量转化为“相似性”度量,并将其用于“体重”。 – Owen

+0

您必须在布局选项中指定权重函数。重量越大表示力量越强,从而使边缘变短。 – maxkfranz