How to specify link distance between nodes in Cytoscape.js?

1k views Asked by At

I am new to Cytoscape.js, so I may be missing something obvious...

I know how to do this in D3.js, but need more power to display clustering of a large number of nodes (> 1,000) and don't need to visualize the links.

Thanks in advance to pointing me in the right direction...

1

There are 1 answers

2
Owen On

It turns out I was looking at the doc for WebCola, not 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' } }
      ]
    }