Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Orthogonal example is not truly orthogonal

37 views
Skip to first unread message

Karel V.

unread,
Mar 2, 2025, 2:43:00 PMMar 2
to ogdf
Hello,

I am new to OGDF, I have just built the code (today's master branch) and looked at the orthogonal example, and I am confused because the SVG output is not truly orthogonal, see screenshot below.

I have checked the code

OrthoLayout *ol = new OrthoLayout;
ol->separation(20.0);
ol->cOverhang(0.4);
pl.setPlanarLayouter(ol);

and looked for some additional options of OrthoLayout, but I could not find any.

Could someone please explain why a few of the edges are neither horizontal nor vertical? I mean, bends are ok, but a number of the edges have a segment which is a bit askew. With some of these edges, it is just their last segment which is very short, but there are also five or more longer edges (straight ones, without bends) where the angle is not perfect.

Is this a SVG rendering issue or an issue with the layout algorithm itself?

Thank you,
Karel V.
output-ERDiagram.jpeg

Niko Fink

unread,
Mar 2, 2025, 4:19:54 PMMar 2
to ogdf
This is probably a difference in how OrthoLayout and the SVG Renderer interpret what the GraphAttributes/Layout means.
The OrthoLayout generates only the bendpoints that are needed such that we get a valid orthogonal drawing *when* connecting them with the vertex boxes in a horizontal/vertical fashion.
The SVG Renderer knows nothing about the fact that you want edges to be orthogonal and simply connects the last bend point with the center point of the vertex.
If you were to export the GraphAttributes to say GML instead of SVG and view the file in a tool that only draws edges orthogonally, the layout would probably look right.

If you want a quick fix here, you can simply compute the intersection point of the horizontal/vertical line that connects the first/last bend point to the bounding box of the target vertex and prepend/append that to the bendpoint list.
In that way, the layout should seem perfectly orthogonal, you just need those "virtual bendpoints" to tell the SVG renderer the exact place in which an edge should end on boundary of the vertex box.

Cheers
Niko

Dagobert Smart

unread,
Mar 3, 2025, 8:48:13 AMMar 3
to ogdf
This is a regression introduced by commit b99d25b4. Using the prior commit 6fde2f69, it works again as expected. Maybe there should be a setting for the SvgPrinter in order to decide whether to draw orthogonal edges. A new issue for this has been created on Github.

Best regards,
Dagobert

Karel V.

unread,
Mar 4, 2025, 5:24:26 PMMar 4
to ogdf
Thanks, Dagobert, you are right.

I did not test the prior commit because that would be too old, but I have reverted the offending commit and managed to resolve merge conflicts (they were trivial), then it worked as expected.

Regards,
Karel V.

output-ERDiagram-fixed.jpeg
Reply all
Reply to author
Forward
0 new messages