简体   繁体   中英

D3: Directional graph similar to tree layout but with back links

I am looking for layout in d3 which allow to layout nodes in directional graph as shown in Collapsible Tree example but the twist is that the directional graphs which I need to plot has converging links also. Its basically MANY-TO-ONE and then ONE-TO-MANY graph and there can be back links/edges as well.

As, I just know the nodes and transitions but not the location of nodes, I was just wondering if D3 can layout this using any existing layout like graphViz does it for digraphs.

There seems to be NO d3 layout to be used directly. Instead, the approach which I have adopted is:

  1. Group all the nodes as per depth from source node.
  2. Sort the nodes at particular level according to the nodes in previous level so as to minimize crossings.
  3. Layout all nodes at a level with same X but different Y coordinates.

This works for me for the cases I am trying to address.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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