简体   繁体   中英

Can a Child node have multiple Parent nodes in Collapsible Force Layout using D3

I'm building a visualization similar to http://bl.ocks.org/mbostock/1093130 , with huge amount of data. I could not figure out if it is possible that a child node can have multiple parent nodes? for instance, as per the visualization shown in the previously mentioned link, can "shortestPaths" have parents "graph" as well as "optimization" ? I have looked around stackoverflow. Could not find answer that solves this problem.

No, it is not possible, if you rely on the example you linked to at the beginning of the question. This is because of this code:

  var nodes = flatten(root),
  links = d3.layout.tree().links(nodes);

d3.layout.tree() requires tree-like data (no multiple parents).

Of course, you can always develop entirely yours solution that will handle such cases. But you can't do it based on the example you mentioned.

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