D3Trees.jl icon indicating copy to clipboard operation
D3Trees.jl copied to clipboard

Compatibility with directed Graphs.jl

Open filchristou opened this issue 2 years ago • 2 comments

Is there any reason why this wouldn't play with DiGraphs ? If you are interested I can push a branch with a constructor D3Tree(::DiGraph) I will actually just transform the Graph in an AbstractTree 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.

filchristou avatar Apr 13 '22 07:04 filchristou

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?

zsunberg avatar Apr 15 '22 05:04 zsunberg

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.

zsunberg avatar Apr 15 '22 05:04 zsunberg