Open filchristou opened 2 years ago
I think this is a good idea - the only issue is that you somehow need to specify a root node. Perhaps it would make more sense to create a DiGraphTreeView or something that stores a DiGraph and a root node and then call D3Tree(::DiGraphTreeView)
?
Also, what information would you display at each node?
Maybe some constraints need to apply (e.g. only graphs that can be transformed to trees).
I think this does not need to be the case necessarily since D3Trees only displays some nodes at first - you can expand the d3 "tree" infinitely if it actually is a graph with cycles (i.e. not strictly a tree). On the other hand, it may be somewhat confusing for users if the same node is displayed in different places.
Is there any reason why this wouldn't play with
DiGraphs
? If you are interested I can push a branch with a constructorD3Tree(::DiGraph)
I will actually just transform theGraph
in anAbstractTree
implementation, where the directed edges lead to children. Maybe some constraints need to apply (e.g. only graphs that can be transformed to trees). I don't know what would happen to the library if there was to be cyclic graphs and multiple parents per node. I am not familiar with the original javascript library.