Skip to content

MDS spacing #385

Open
Open

Description

I am trying to use MDS / rectiliniear layout, but the spacing is very high:

// MDS
var settings = new Microsoft.Msagl.Layout.MDS.MdsLayoutSettings();
settings.EdgeRoutingSettings = new Microsoft.Msagl.Core.Routing.EdgeRoutingSettings();
switch (li)
{
    case 3:
        settings.EdgeRoutingSettings.EdgeRoutingMode = 
            Microsoft.Msagl.Core.Routing.EdgeRoutingMode.Spline;
        break;

    case 4:
        settings.EdgeRoutingSettings.EdgeRoutingMode =
            Microsoft.Msagl.Core.Routing.EdgeRoutingMode.Rectilinear;
        settings.RemoveOverlaps = true;
        settings.NodeSeparation = 1;
        settings.EdgeRoutingSettings.Padding = 0.1;
        settings.EdgeRoutingSettings.PolylinePadding = 0.1  ;

        break;
}
return settings;

Image

Activity

  1. levnach commented on Dec 18, 2024

    @levnach
    Collaborator

    Please try another method. It starts from MDS but then improves it.

    LayoutHelpers.CalculateLayout(graph,
                new FastIncrementalLayoutSettings {
                    EdgeRoutingSettings = {
                        EdgeRoutingMode = EdgeRoutingMode.Rectilinear,
                        CornerRadius = 90
                    },
                    NodeSeparation = 50, // Minimum space between nodes
                    AvoidOverlaps = true,
                    
                }, null);
    
    
  2. MichaelHoffmeisterFesto commented on Dec 19, 2024

    @MichaelHoffmeisterFesto
    Author

    Thank you. This gave a funny but rather unusable result (see below).

    Do --> I <-- have to call CalculateLayout() maybe even twice? I'am using MsaglWpfViewer, just feeding in the settings I am creating by a switch statement.

    Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions