Open nanofrog opened 1 year ago
In general, it is difficult to guarantee that one edge is to the left of another, but with the nodes it is possible. Here is your code with my changes working for me.
Graph graph = new Graph(); var rightEdge = graph.AddEdge("11111", "0"); var leftEdge = graph.AddEdge("11111", "22222222222222222222222222"); graph.LayerConstraints.AddLeftRightConstraint(leftEdge.TargetNode, rightEdge.TargetNode);
In general, it is difficult to guarantee that one edge is to the left of another, but with the nodes it is possible. Here is your code with my changes working for me.
Graph graph = new Graph(); var rightEdge = graph.AddEdge("11111", "0"); var leftEdge = graph.AddEdge("11111", "22222222222222222222222222"); graph.LayerConstraints.AddLeftRightConstraint(leftEdge.TargetNode, rightEdge.TargetNode);
Year, I knew the algorithm may switch nodes in same rank to decrease crossing edges. but my demo is so simple, there's no need to do any switch. In another issue, somebody mentioned that it may relate to the DFS processing of nodes' out edges. if a stack is used in DFS, left edge will be pushed first, and pop up at last. then it will be arranged at right. Is this a possible reason?
The edge drawing algorithm of the tool follows https://ieeexplore.ieee.org/abstract/document/221135/ with some modifications.
I test WpfApplicationSample with codes below, the first edge will always on the left, and 2nd edge is on the right. I knew the order of sibling nodes may be changed during layout. but my sample code is so simple. so how can I keep the edge from left to right with the order in codes?