microsoft / automatic-graph-layout

A set of tools for graph layout and viewing
Other
1.35k stars 304 forks source link

Crash on collapsing subgraphs #373

Open ATrefzer opened 1 month ago

ATrefzer commented 1 month ago

Hi, I want to report an crash with collapsing a sub graph.

I use the current version of the repository (commit b199357).

Note: It broke in commit: 0cc1abe61d5069f50b87f920f9190c9a8fd573fb In the commit before it worked.

You can reproduce it with following example:

grafik

While you can collapse Model C the other crash. I think it happens when the edge goes to the cluster itself and not to an inner node.

The exception occurs in the file SplineRouter in method CalculatePortsToShapes. grafik

I used following lines to build the graph:

          Subgraph subGraph = null;
          Subgraph parentSubGraph = null;
          Node newNode = null;
          var graph = new Graph("test");
          var structA = new Subgraph("StructA");
          var modelC = new Subgraph("ModelC");
          var modelB = new Subgraph("ModelB");
          graph.RootSubgraph.AddSubgraph(structA);
          graph.RootSubgraph.AddSubgraph(modelC);
          graph.RootSubgraph.AddSubgraph(modelB);
          newNode = graph.AddNode("Fill");
          parentSubGraph = structA;
          parentSubGraph.AddNode(newNode);
          newNode = graph.AddNode("MethodOnModelC");
          parentSubGraph = modelC;
          parentSubGraph.AddNode(newNode);
          newNode = graph.AddNode("_structA");
          parentSubGraph = modelB;
          parentSubGraph.AddNode(newNode);
          graph.AddEdge("Fill", "ModelB");
          graph.AddEdge("MethodOnModelC", "ModelB");
          graph.AddEdge("_structA", "StructA");