Skip to content

LayerConstraints are not enforced when Subgraph is present #228

Description

@Oaz

I think I've found an issue with Graph.LayerConstraints.AddUpDownConstraint / Graph.LayerConstraints.AddLeftRightConstraint.
In a simple graph, the feature works fine but, when using subgraphs, constraints are no longer enforced.

I figured out the Dictionary<Node, int> nodeIdToIndex fields in VerticalConstraintsForSugiyama / HorizontalConstraintsForSugiyama might be related to this issue.
When using subgraphs, some Layout.Node duplication occur and the Node keys in the dictionary never match.
As a consequence, int NodeIndex(Node node) always returns -1.

For example, the following graph has no layout constraints:
image

If I add a layout constraint where all nodes must be ordered from top to bottom in lexical order, I should get the following graph:
image

The latest image was generated using a hack where I changed Dictionary<Node, int> nodeIdToIndex into Dictionary<string, int> nodeIdToIndex and using node.ToString() as keys.
Without this hack, I get the same graph as the one with no constraint.

Activity

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