# Minimum length of edge in the Graph

**URL:** https://forum.graphviz.org/t/minimum-length-of-edge-in-the-graph/325
**Category:** Help
**Created:** [September 1, 2020, 5:50pm UTC](https://forum.graphviz.org/t/minimum-length-of-edge-in-the-graph/325 "2020-09-01T17:50:39Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![bsp13](https://avatars.discourse-cdn.com/v4/letter/b/d2c977/32.png) [@bsp13](https://forum.graphviz.org/u/bsp13)
#### Post date: [September 1, 2020, 5:50pm UTC](https://forum.graphviz.org/t/minimum-length-of-edge-in-the-graph/325/1 "2020-09-01T17:50:39Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![magjac](https://sea2.discourse-cdn.com/graphviz/user_avatar/forum.graphviz.org/magjac/32/16_2.png) [@magjac](https://forum.graphviz.org/u/magjac)
#### Post date: [September 1, 2020, 6:33pm UTC](https://forum.graphviz.org/t/minimum-length-of-edge-in-the-graph/325/2 "2020-09-01T18:33:52Z")

</div>

The [minlen](https://graphviz.org/doc/info/attrs.html#a: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]

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

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

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

```

[/dot]  
[dot]

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

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

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

```

[/dot]

---

<div class="post-metadata">

### Author: ![bsp13](https://avatars.discourse-cdn.com/v4/letter/b/d2c977/32.png) [@bsp13](https://forum.graphviz.org/u/bsp13)
#### Post date: [September 1, 2020, 6:58pm UTC](https://forum.graphviz.org/t/minimum-length-of-edge-in-the-graph/325/3 "2020-09-01T18:58:25Z")

</div>

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

---

<div class="post-metadata">

### Author: ![magjac](https://sea2.discourse-cdn.com/graphviz/user_avatar/forum.graphviz.org/magjac/32/16_2.png) [@magjac](https://forum.graphviz.org/u/magjac)
#### Post date: [September 1, 2020, 8:05pm UTC](https://forum.graphviz.org/t/minimum-length-of-edge-in-the-graph/325/4 "2020-09-01T20:05:33Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![bsp13](https://avatars.discourse-cdn.com/v4/letter/b/d2c977/32.png) [@bsp13](https://forum.graphviz.org/u/bsp13)
#### Post date: [September 2, 2020, 5:23am UTC](https://forum.graphviz.org/t/minimum-length-of-edge-in-the-graph/325/5 "2020-09-02T05:23:37Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![magjac](https://sea2.discourse-cdn.com/graphviz/user_avatar/forum.graphviz.org/magjac/32/16_2.png) [@magjac](https://forum.graphviz.org/u/magjac)
#### Post date: [September 2, 2020, 9:01am UTC](https://forum.graphviz.org/t/minimum-length-of-edge-in-the-graph/325/6 "2020-09-02T09:01:06Z")

</div>

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](https://gitlab.com/graphviz/graphviz/-/issues/new).
