-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ordered trees #221
Comments
Hey @Muon, in order to use the tree layout our data needs to be formatted hierarchically. Does Edgy use flat formatting? That seems to be the case. This article suggests a method to convert the data, under the heading "Generating a tree diagram from ‘flat’ data". I've tried implementing this as part of redrawGraph() but had no luck, and thought I'd better ask for help. Is this where you'd do the conversion? |
Yeah, we don't do anything special. Yes, I'd put it in EDIT: no, this won't work. JSNetworkX's renderer expects the usual EDIT 2: There Is Another Way. Write your own |
Once we have this it would be nice to illustrate using linguistic trees. |
Unfortunately, implementing this would require making changes to JSNetworkX, as the type of data JSNetworkX does initialization itself and provides the layout with nodes and edges, which are not what the tree layout expects. I'm not sure if it's worth making more of our own changes to JSNetworkX in order to get this to work. |
@tgdwyer do you have any advice about rendering ordered trees? |
The issue I've come across with this is that using The ordered tree layout needs a root node (which would need to be specified by the user for undirected graphs as any node could be considered the root), and each node would need to know its children. We could generate the required data structure (we'd have to get the root node from the user and ensure the graph is acyclic) to use the tree layout. Then if the graph were to change, we could regenerate the data structure to keep things synchronised and if the graph were to become cyclic, or the root deleted, then we could fall back to the previous layout algorithm. This is certainly doable - I'm not sure about performance implications of keeping a secondary graph data structure synchronised, but I don't imagine it'd be too bad. It might require a bit of bug testing to ensure that it all works properly. |
There are some more options to consider:
|
Add a layout option for ordered trees, cf:
https://github.com/mbostock/d3/wiki/Tree-Layout#tree
The text was updated successfully, but these errors were encountered: