admin管理员组文章数量:1327115
So I am using to create a collapsible tree and it works great.
Now the thing is I have some nodes which have the same children, so I want to know if there is any way to visualize the graph in such a way that both the parents expand to the same child?
So basically when you expand the node of a parent it should automatically expand the node of the other parent leading to the same mon child, is this possible with any graph?
So I am using http://bl.ocks/mbostock/4339083 to create a collapsible tree and it works great.
Now the thing is I have some nodes which have the same children, so I want to know if there is any way to visualize the graph in such a way that both the parents expand to the same child?
So basically when you expand the node of a parent it should automatically expand the node of the other parent leading to the same mon child, is this possible with any graph?
Share Improve this question edited Jan 15, 2015 at 15:34 VividD 10.5k8 gold badges66 silver badges112 bronze badges asked Dec 31, 2013 at 7:19 X-joX-jo 6011 gold badge6 silver badges13 bronze badges 5- Maybe a collapsible force layout is more suitable for you? – Lars Kotthoff Commented Dec 31, 2013 at 9:50
- its still the same, two parents don't expand to one node. ViviD says in the response that this can't be done by d3 alone. – X-jo Commented Dec 31, 2013 at 14:12
- 1 It can be done in D3, just not with the existing layouts. It would be easier to implement with a force layout than with a tree layout though. – Lars Kotthoff Commented Dec 31, 2013 at 14:38
- stackoverflow./questions/20525458/… i will try this, thanks – X-jo Commented Jan 1, 2014 at 10:18
- X-jo can you post your findings? – mehmet Commented Dec 26, 2015 at 18:22
1 Answer
Reset to default 6From your description, I gather you need to visualize directed acyclic graph, or DAG.
Tree is:
A
|\
B C
/ \
D E
DAG is:
A
|\
B C
\|
D
And, no, unfortunately, D3 tree and cluster layouts simply don't support that kind of graphs. Their internal algorithms assume that the data structure is strictly a tree.
However, there are some options. Please see these five related questions for possible approaches:
d3 tree - parents having same children
How to layout a non-tree hierarchy with D3
d3.js tree nodes with same parents
Layered graphs in d3.js
JS library for displaying direct acyclic graphs (DAGs)
本文标签: javascriptD3jscollapsible treehow to connect different parents with same childStack Overflow
版权声明:本文标题:javascript - d3.js, collapsible tree - how to connect different parents with same child - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742203553a2432398.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论