microsoft / microsoft/automatic-graph-layout

LayoutHelpers.CalculateLayout() crashes with OverlapRemovalMethod set to Prism

Open
#209 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
1.5k
Forks
319
Avg merge
38m
Merged PRs (30d)
1

Description

On this configuration

    Microsoft.Msagl.Layout.MDS.MdsLayoutSettings msaglMdsLayoutSettings= new Microsoft.Msagl.Layout.MDS.MdsLayoutSettings();        
    msaglMdsLayoutSettings.EdgeRoutingSettings.EdgeRoutingMode = Microsoft.Msagl.Core.Routing.EdgeRoutingMode.StraightLine;
    msaglMdsLayoutSettings.NodeSeparation = 0.05f;
    msaglMdsLayoutSettings.ScaleX = 5.0f;
    msaglMdsLayoutSettings.ScaleY = 5.0f;
    msaglMdsLayoutSettings.RemoveOverlaps = true;
    msaglMdsLayoutSettings.OverlapRemovalMethod = Microsoft.Msagl.Core.Layout.ProximityOverlapRemoval.MinimumSpanningTree.OverlapRemovalMethod.Prism;

When the nodes are added to the graph but there are no edges connected to them which are not added. Then we draw the layout it crashes.

An example:

    Node a = new Node(CurveFactory.CreateRectangle(0.05f, 0.05f, new Microsoft.Msagl.Core.Geometry.Point()), "a");
    Node b = new Node(CurveFactory.CreateRectangle(0.05f, 0.05f, new Microsoft.Msagl.Core.Geometry.Point()), "b");
    Node c = new Node(CurveFactory.CreateRectangle(0.05f, 0.05f, new Microsoft.Msagl.Core.Geometry.Point()), "c");
    msaglGraph.Nodes.Add(a);
    msaglGraph.Nodes.Add(b);
    msaglGraph.Nodes.Add(c);
    Edge e1 = new Edge(a, b);
    msaglGraph.Edges.Add(e1);

That example crashes because there is a node c which isn't connected by any edges. Anyone know if this is a bug?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the provided three-node example with MdsLayoutSettings, Prism overlap removal, and one unconnected node. Trace LayoutHelpers.CalculateLayout() to identify the crash, then verify that the same configuration completes without crashing and includes the disconnected node in the layout.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
computer-graphics
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.