d3.js - D3: Is it possible to add multiple (more than 2) edges between nodes? -


this question has answer here:

i constructing d3 force graph visualize network traffic. need link 2 nodes more 2 paths. possible? appreciated.

nothing prevents drawing multiple edges between nodes. thing force directed graph layout made 2 nodes share 1 link. recommend following:

  • from force directed graph point of view have 1 link.
  • on drawing point of view, draw multiple edges if both nodes have multiple edges.

which give following data structure edges:

links = {     source: 0, //index of source node     target: 0 //index of target node     representations : [{color: "red"}, {color:"blue"}] } 

thus when give links force directed graph, won't complain. when draw link can iterate through representations array draw different links.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -