I’m trying to make edges go from the North port of one node to the North port of another node. The nodes are next to each other, left to right. However, when the edge is drawn, it dips below to the South end of the nodes before coming back to the North port of the destination node. It looks kind of terrible. Any ideas on how to fix this? Including the code and a picture down below.
// NFA
digraph {
rankdir=LR ranksep=.25
0 [label="(" rank=same]
1 [label="(" rank=same]
2 [label=A rank=same]
3 [label="*" rank=same]
4 [label=B rank=same]
5 [label="|" rank=same]
6 [label=A rank=same]
7 [label=C rank=same]
8 [label=")" rank=same]
9 [label=D rank=same]
10 [label=")" rank=same]
0 -> 1 [style=invis]
1 -> 2 [style=invis]
2 -> 3 [style=invis]
3 -> 4 [style=invis]
4 -> 5 [style=invis]
5 -> 6 [style=invis]
6 -> 7 [style=invis]
7 -> 8 [style=invis]
8 -> 9 [style=invis]
9 -> 10 [style=invis]
2:e -> 3:w [color=black constraint=false]
4:e -> 5:w [color=black constraint=false]
6:e -> 7:w [color=black constraint=false]
7:e -> 8:w [color=black constraint=false]
9:e -> 10:w [color=black constraint=false]
0:e -> 1:w [color=red constraint=false]
1:e -> 2:w [color=red constraint=false]
3:e -> 4:w [color=red constraint=false]
8:e -> 9:w [color=red constraint=false]
2:ne -> 3:nw [color=red constraint=false]
3:sw -> 2:se [color=red constraint=false]
1:se -> 6:sw [color=red constraint=false]
5:ne -> 8:nw [color=red constraint=false]
}
1 Like
Here is a quick fix:
The key takeaway is to get rid of the constraint=false
on edges and use weight
instead:
digraph g0c013edc93434e2bb0d56655dfc06e1b {
graph [bb="0 0 774 84",
name="%171",
rankdir=LR,
ranksep=.25
];
node [label=""];
n8ef0051e07f544d8a15ef07905a5357f [label="("];
ne079c6aef7664cff953ac0bb6fd13459 [label="("];
n8ef0051e07f544d8a15ef07905a5357f -> ne079c6aef7664cff953ac0bb6fd13459 [key=e33617f443f4344849c4e4a4450b85243,
color="#ff0000ff",
weight=10];
n69525b5fed6f446087232594a11ad014 [label=A];
ne079c6aef7664cff953ac0bb6fd13459 -> n69525b5fed6f446087232594a11ad014 [key=ea65d5d966670440a9010ee31c3d41f74,
color="#ff0000ff",
weight=10];
n77aa9bf8ff9740ceb95f10c845fc658b [label=A];
ne079c6aef7664cff953ac0bb6fd13459 -> n77aa9bf8ff9740ceb95f10c845fc658b [key=e908b17ba5c1c4407af18781e49984ccb,
color="#ff0000ff"];
n46db5635e0de4df5962325bd3738693e [label="*"];
n69525b5fed6f446087232594a11ad014:se -> n46db5635e0de4df5962325bd3738693e:sw [key=e45021a13148f482b9c57e57555320732,
color="#ff0000ff",
dir=back];
n69525b5fed6f446087232594a11ad014 -> n46db5635e0de4df5962325bd3738693e [key=e5d09dfd5381f4cb3b6944a9f960fa8d8,
weight=10];
n46db5635e0de4df5962325bd3738693e:nw -> n69525b5fed6f446087232594a11ad014:ne [key=e23b9b117a7bd47ffa781a1cc1f1dbc16,
color="#ff0000ff",
dir=back];
n8d28ac98ce0e4d6ba66003584b681bd0 [label=B];
n46db5635e0de4df5962325bd3738693e -> n8d28ac98ce0e4d6ba66003584b681bd0 [key=e2a1644fe70fc40e2b479f42a31855dd7,
color="#ff0000ff",
weight=10];
n9a95254cc9474bd199316490f856330a [label="|"];
n8d28ac98ce0e4d6ba66003584b681bd0 -> n9a95254cc9474bd199316490f856330a [key=e60cac0f814d14320bf797660902ddb1b,
weight=10];
n9a95254cc9474bd199316490f856330a -> n77aa9bf8ff9740ceb95f10c845fc658b [key=e35740282aa2d4e79bf351371b374c426,
color="#00000000",
weight=10];
nff548113741e4e309f97d7da9d6a1126 [label=")"];
n9a95254cc9474bd199316490f856330a -> nff548113741e4e309f97d7da9d6a1126 [key=ecfa4db75502e46f28a4b9fa1c5e05407,
color="#ff0000ff"];
n99fc5627e7db4cf4ab0f39b43fa1aa4c [label=C];
n77aa9bf8ff9740ceb95f10c845fc658b -> n99fc5627e7db4cf4ab0f39b43fa1aa4c [key=e9d9223b7b700446d8c8b69c99de059e1,
weight=10];
n99fc5627e7db4cf4ab0f39b43fa1aa4c -> nff548113741e4e309f97d7da9d6a1126 [key=ebe14ad705c9d4ad9a1b00709066786e7,
weight=10];
n918592f09cc540318b1c2da3e2a6a316 [label=D];
nff548113741e4e309f97d7da9d6a1126 -> n918592f09cc540318b1c2da3e2a6a316 [key=e44081397f80f41aea2d8ddfe644c1c97,
color="#ff0000ff",
weight=10];
nde44779a1d814d3984881d9d68362b53 [label=")"];
n918592f09cc540318b1c2da3e2a6a316 -> nde44779a1d814d3984881d9d68362b53 [key=ec08c1eec6f2e4e06a23940c6807c1455,
weight=10];
}
Fantastic, thank you so much!!