magjac/graphviz-visual-editor

Allow Subgraphs to be created from the UI

powderluv opened this issue · 2 comments

Can we please have a feature to select a few nodes and add them to a subgraph ?

That's an interesting proposal. I've avoided subgraphs so far because they have no representation in the generated graph and there are many ways to describe a graph DOT source that gives the same generated graph.

It would be possible to create a new subgraph though and place the nodes in it. The question is then also if fully contained edges should be placed with them or not? Also, both the nodes and edges might already be part of other subgraphs. Should they stay there as well as in the new subgraph or should they be removed from the old subgraphs. I guess stay in order not to change possible attribute settings.

There's probably plenty of other cases to consider, but perhaps you have a simple solution already in mind?

I think the creating a new subgraph should suffice. Maybe it can create something like this:

image
credit: https://forum.graphviz.org/t/clusters-outline-geometry-attribute/313/2

And then if we can select edges and snap them to either other nodes or subgraphs we can provide a way to represent compound attributes.

Yeah if nodes are already part of a subgraph they can be a nested subgraph.

Essentially we take a good default for subgraphs (new subgraph, nest existing subgraphs, maintain relationship to nodes and not subgraphs) and then allow for editing in anyway the user wants.