Minimum length of edge in the Graph

Here is my dot file::

digraph “test” {
node [ shape = circle ];

“state” [ value = “” ];
“IDLE” [ value = “INT:0” ];

“state” -> “IDLE” [
xlabel = “”
minlen = 2
line = “18”
];
}
I added minlen=2 (inch) in the edge attribute. It give splines from[const splines *spline = ED_spl(m_edge);] . In this, I draw edge and compute length of edge using QPainterpath in Qt. But I will not get same or greater length of the edge from graphviz because I need minimum length and here, my minimum length is 2 inch. Is this right attribute parameter of minimum edge length.
I also change Graphviz internal coordinate system to Qt coordinate system for computing edge length but i did not get valid length of the edge when i compute in Qt.

1 Like

The minlen attribute is valid only for the dot layout engine. Perhaps you are using another engine?

Here you can see that the minlen attribute has an effect:

[dot verbose=true repeat=true]

digraph “test” {
    node [ shape = circle ];

    “State” [ value = “” ];
    “IDLE” [ value = “INT:0” ];

    “state” -> “IDLE” [
        xlabel = “”
        minlen = 2
        line = “18”
    ];
}

[/dot]
[dot]

digraph “test” {
    node [ shape = circle ];

    “State” [ value = “” ];
    “IDLE” [ value = “INT:0” ];

    “state” -> “IDLE” [
        xlabel = “”
        minlen = 4
        line = “18”
    ];
}

[/dot]

I am using QGraphicsScene for rendering…

Here minlen = 2 but when i calculate length of edge in Qt using QPainterPath that time its smaller… It is not 2 inch

1 Like

Ok. To clairfy; which of these two problems do you have?

  1. You cannot change the edge length at all in Qt with the minlen attribute.
  2. You can change the edge length in Qt with the minlen attribute, but the unit is not correct.

I have problem number (2)… length of the edge is changed using minlen attribute but unit is not same…
I need if I set attribute minlen=1(1 inch) than it will give me minimum length of the edge 96 pixels(1 inch) with QPainterpath in Qt.

1 Like

I tried generating ps and svg output and I can’t get the units correct either. It’s seems that ps output is around 74 % of the correct value and svg around 33%.

Perhaps someone else can clairify? You can also open an issue at https://gitlab.com/graphviz/graphviz/-/issues/new.