sisl / D3Trees.jl

Flexible interactive visualization for large trees in Julia using D3.js
Other
39 stars 7 forks source link

Compatibility with directed Graphs.jl #23

Open filchristou opened 2 years ago

filchristou commented 2 years ago

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.

zsunberg commented 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?

zsunberg commented 2 years ago

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.