magjac / graphviz-visual-editor

A web application for interactive visual editing of Graphviz graphs described in the DOT language.
http://magjac.com/graphviz-visual-editor
MIT License
705 stars 74 forks source link

Allow Subgraphs to be created from the UI #150

Open powderluv opened 4 years ago

powderluv commented 4 years ago

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

magjac commented 4 years ago

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?

powderluv commented 4 years ago

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.