Hi,
I was working on some graph related work with python modules and i was trying to make some changes to output graph(dot engine) with some layout properties.
Am getting the following dot graph
I have tried for changing the layout and other programmatically by passing some of these properties:
overlap = false
splines = ortho
rankdir = TB
and my final output as bellow, how can i make it look batter with proper alignment and readable as not able to notice respective edge labels.
mark
August 21, 2023, 8:20am
2
I think you’ve got so many overlapping edges that you’re probably going to struggle in two dimensions. Maybe you could divide your graph up and make graphs of a few different subsets of your graph in separate pictures?
is there something config which will do it? cause is all depends on the data itself every thing in a flow. Or can you recommend me some sort of properties for dot graph so that my 1st output will align to a structured and organised.
mark
August 21, 2023, 10:04am
4
Fundamentally with everything connected to everything you are going to struggle to make a layout that makes sense.
Maybe you should try a “circo” graph?
https://graphviz.org/docs/layouts/circo/
jjlong
August 22, 2023, 1:00am
6
In addition to the advice from @steveroush , in no particular order:
Use a fixed node size for all nodes.
Split the node labels on to multiple lines, allowing a narrower node.
Use taillabel
instead of label
for edges when splines=ortho
.
Set tail label font name to Arial
using labelfontname="Arial"
Set tail label font size to something smaller using labelfontsize=10
Use labeldistance
attribute to move the tail label position.
Use smaller arrowheads on edges using arrowsize=0.5
Spread the nodes out horizontally and vertically a bit using nodesep=0.625
and ranksep=0.625
Here is the results I came up with:
Here is the source for the diagram
strict digraph "main"
{
layout="dot";
splines="ortho";
imagepath="C:\rv";
node[ shape=rect height=1 width=1 fixedsize=true ];
edge[ arrowsize="0.5" fontname="Arial" labelfontname="Arial" labelfontsize="10" ];
nodesep=".625"
ranksep=".625"
{ rank="source"; "start";}
"start"[ shape="octagon" height="1" width="1" fixedsize="True" fillcolor="Blue4" peripheries="2" fontname="Arial" fontcolor="White" style="filled" label="Start" ];
{ rank="sink"; "end";}
"end"[ shape="octagon" height="1" width="1" fixedsize="True" fillcolor="Blue4" peripheries="2" fontname="Arial" fontcolor="White" style="filled" label="End" ];
"start" -> "invoice date"[ penwidth=2 taillabel="1 Day" ];
"first discount available date"[ label="First\nDiscount\nAvailable\nDate" ];
"first discount available date" -> "invoice release date"[ labeldistance=3 taillabel="15 Day(s)" ];
"first discount available date" -> "payment due date"[ penwidth=2 ];
"first discount available date" -> "second discount available date"[ labeldistance=2 taillabel="10 Day(s)" ];
"first discount available date" -> "invoice creation date"[ labeldistance=1 taillabel="6 Day(s)" ];
"invoice creation date"[ label="Invoice\nCreation\nDate" ];
"invoice creation date" -> "first discount available date";
"invoice creation date" -> "invoice hold date";
"invoice creation date" -> "invoice approval creation date"[ taillabel="1 Min(s)" ];
"invoice creation date" -> "payment date";
"invoice creation date" -> "end";
"invoice approval creation date"[ label="Invoice\nApproval\nCreation\nDate" ];
"invoice approval creation date" -> "payment due date"[ taillabel="29 Days" ];
"invoice approval creation date" -> "invoice approval creation date"[ taillabel="1 Hr(s)" ];
"invoice hold date"[ label="Invoice\nHold\nDate" ];
"invoice hold date" -> "invoice hold date"[ taillabel="2 Day(s)" ];
"invoice hold date" -> "invoice release date"[ taillabel="3 Day(s)" ];
"invoice hold date" -> "first discount available date"[ taillabel="7 Day(s)" ];
"invoice hold date" -> "second discount available date"[ taillabel="6 Day(s)" ];
"invoice hold date" -> "payment due date"[ penwidth=2 taillabel="24 Day(s)" ];
"invoice hold date" -> "end";
"payment due date"[ label="Payment\nDue\nDate" ];
"payment due date" -> "payment date"[ taillabel="4 Day(s)" ];
"payment due date" -> "invoice creation date"[ penwidth=2 taillabel="25 Day(s)" ];
"payment due date" -> "invoice release date"[ taillabel="7 Day(s)" ];
"payment due date" -> "end";
"invoice release date"[ label="Invoice\nRelease\nDate" ];
"invoice release date" -> "payment due date"[ taillabel="7 Day(s)" ];
"invoice release date" -> "first discount available date"[ taillabel="15 Day(s)" ];
"invoice release date" -> "end";
"payment date"[ label="Payment\nDate" ];
"payment date" -> "invoice date"[ color=gray taillabel="0 Sec" ];
"payment date" -> "second discount available date"[ taillabel="7 Day(s)" ];
"payment date" -> "third discount available date"[ taillabel="8 Day(s)" ];
"payment date" -> "payment due date"[ penwidth=2 taillabel="23 Day(s)" ];
"payment date" -> "end";
"second discount available date"[ label="Second\nDiscount\nAvailable\nDate" ];
"second discount available date" -> "third discount available date"[ taillabel="10 Day(s)" ];
"second discount available date" -> "payment date"[ taillabel="1 Day(s)" ];
"invoice date"[ label="Invoice\nDate" ];
"invoice date" -> "first discount available date"[ labeldistance=1 taillabel="10 Day(s)" ];
"invoice date" -> "payment date"[ labeldistance=2 taillabel="14 Day(s)" ];
"invoice date" -> "invoice creation date"[ labledistance=3 color=gray taillabel="1 Day(s)" ];
"invoice date" -> "payment due date"[ labeldistance=4 color=gray taillabel="2 Day(s)" ];
"third discount available date"[ label="Third\nDiscount\nAvailable\nDate" ];
"third discount available date" -> "payment due date"[ penwidth=2 taillabel="1 Mo" ];
}
jjlong
August 22, 2023, 1:13am
7
@mark Here is how circo
rendered the diagram using the Graphviz source in my earlier post.
mark
August 22, 2023, 2:19am
8
Yeah with circo i would probably turn off the rectinlinear lines
Thanks @jjlong , @steveroush
will work around the graph as per your instructions and let you guys know…
jjlong
August 22, 2023, 11:24am
10
Here is what it looks like with the splines
attribute removed.