strathausen / dracula

JavaScript layout and representation of connected graphs.
https://www.graphdracula.net
MIT License
834 stars 132 forks source link

Groups, Expandable Collapsible groups #37

Closed botev closed 6 years ago

botev commented 7 years ago

So, I don't know if this is on your roadmap, but many libraries for graph lack this functionality and in many cases where we have some hierarchy in large graphs such features are a must. Just to explain in more details:

Allow nodes to be assigned to groups, and groups to be assignable to other groups as well to form hierarchies. Allow easy to collapse/expand groups to a single node.

Sorry I can't help with this, but really I am not experienced in js.

nicopace commented 7 years ago

any news on this?

strathausen commented 6 years ago

I'm thinking about how to make the graph display more dynamic, like removing and adding nodes... this ticket would definitely part of it once I find a nice solution.

monomon commented 6 years ago

@botev do you perhaps mean Raphael sets? They seem to fit your description, though they do not use svg \<g> elements underneath. It is possible to use these in the node renderers to group elements together.

Note that the elements are only related in the context of the set. As I said, the svg elements that belong to the group remain as they are, and the relation is kept in memory.

monomon commented 6 years ago

I would like to give this ticket a try.

The logical flow is - if there is a series of nodes connected by directed edges, then allow collapsing all nodes "downstream", e.g. by clicking the node. This seems like a clear enough convention.

We already have tree layouts that we can use for this. It makes sense to subclass Graph into a HierarchicalGraph that keeps all the relational information and adds some methods for operating on the tree (dom-style).

A more advanced version could allow nodes that are "tagged" to be hidden, regardless of where in tree they are in (i.e. might not have a hierarchical relation).

Implementing this sort of depends on preserving layout between redraws, which is https://github.com/strathausen/dracula/issues/10

Otherwise it would feel very weird that the updated graph would be completely re-laid out.

strathausen commented 6 years ago

I added this feature request to the list https://github.com/strathausen/dracula/projects/1