Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

d3 tree - parents having same children

I have been transitioning my code from JIT to D3, and working with the tree layout. I have replicated the code from http://mbostock.github.com/d3/talk/20111018/tree.html with my tree data, but I wanted to do a little more.

In my case I wanted to create child nodes that merge back to form a parent at a lower level, which I realize is more of a directed graph structure, but would like the tree to accomodate this (i.e. notice that common id's between child nodes should merge).

So basically a tree that divides like normal on the way from parents to children, but then also has the ability to bring those children nodes together to be parents (sort of an incestual relationship or something :)).

Asks something similar -> How to layout a non-tree hierarchy with D3

It sounds like I might be able to use hierarchical edge bundling in conjunction with the tree hierarchy layout, but I haven't seen that done. I might be a little off with that though.

like image 721
Larry Anderson Avatar asked Oct 07 '22 14:10

Larry Anderson


1 Answers

I've been working on a library, called dagre, for laying out directed graphs in the JavaScript. We have an example for how it can be used with D3. Maybe this suits your needs?

like image 102
Chris Pettitt Avatar answered Oct 13 '22 10:10

Chris Pettitt