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:
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:
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.
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 inVerticalConstraintsForSugiyama
/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:
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:
The latest image was generated using a hack where I changed
Dictionary<Node, int> nodeIdToIndex
intoDictionary<string, int> nodeIdToIndex
and usingnode.ToString()
as keys. Without this hack, I get the same graph as the one with no constraint.