"len" attribute ignored for some edges

Hi,
I have simple graph and when it is rendered, the nodes partially cover edge labels.
I tried multitude of attributes on edge and graph level and the only one which has any impact was the “len” on edge.
Unfortunately (and strangely) it works on one edge as expected and was completely ignored on another edge in the graph. (see attached image)

My graph parameters:
renderer: “neato”
output image type: “png”
overlap: false
concentrate: true
K: 0.2
output order: “edgesfirst”
splines: “curved”
rankdir: “LR”
dpi: 60

I tried so many hacks already without success, so any tips will be appreciated.

Screenshot 2021-06-02 152433

Please tell us what version of Graphviz you are using:

neato -V

Based on a quick look, there are no outstanding issues related to neato & len (Issues · graphviz / graphviz · GitLab)
The units for len are inches, so I’d expect your file sets len to something in the neighborhood of .25 to 3.
Next, can you replace the text in you graph with gibberish and then post the (altered) source. It is hard to debug a file without the file itself.
Finally, for this “simple graph”, why neato and not dot?

In neato it sets the target edge length, but there is no guarantee this will be satisfied. For example what if it were the following
a – b [len=1]
b – c [len=1]
c – a [len=100]

You can increase the weight of certain edges, to increase the penalty of not having their ideal length.

Hi Steveroush,
Let me point out my replies:

  • rather latest version, as I installed graphviz just few days ago
  • the “len” of both edges was set to values like 50 (small values like you suggested didn’t have any visual impact)
  • I don’t have the strict source as the graph is built programmatically via some lib (for node.js), but the nodes and edges have only simple attrs like labels, colors, font
  • I tried “dot” but it did not display edge labels at all

BR,
Piotr

Hi Scnorth,

I tried to play with edge weight, rank, and other things, nothing helped…

Can you set the output format to “dot” (instead of png, svg, or whatever it currently is)? This would show the resulting input. That would really help.

Hi,
I managed to get the “dot” output and I put it into some online renderers and played with it.
When I render it with “neato” the initial result is the same, but when I add the “len” attrs, both edges are longer in similar length and it looks good.
If I render the “dot” source with added “len” attrs, they are both outputted properly - all fine.
The strange thing is that when I change back into “png” (in my app), one of the edges again ignores the “len”… (as in the initial picture)
I’m really frustrated with this stuff… :slightly_frowning_face:
I can only get better look if I change the renderer to “fdp”, so probably I will just stick to this.

Here is the source:
digraph G {
graph [K=0.2,
bb="-282.37,-85.395,269.63,81.95",
concentrate=true,
dpi=60,
fontname=Helvetica,
outputorder=edgesfirst,
overlap=false,
rankdir=LR,
splines=curved
];
node [label="\N"];
7864288 [fillcolor="#4EB1CB",
fontcolor=black,
fontname=Helvetica,
height=0.65278,
label=" AVIVA xzxzx|NIP: 11111",
pos="-6.3667,3.4446",
shape=Mrecord,
style=filled,
width=7.6667];
7879978 [fillcolor="#717ECD",
fontcolor=black,
fontname=Helvetica,
height=0.65278,
label=" POLSKI KONCERN xzxzxzx|NIP: 111111",
pos=“35.683,58.45”,
shape=Mrecord,
style=filled,
width=4.1528];
7864288 → 7879978 [color="#00 00 00 40",
fontname=Helvetica,
label=“6.29%”,
lp="-12.029,34.695",
pos=“e,17.061,35.422 10.529,26.593 10.688,26.809 10.845,27.023 11,27.234”];
7881249 [fillcolor="#717ECD",
fontcolor=black,
fontname=Helvetica,
height=0.65278,
label=" ENERGOMONTA xxzxzx|NIP: 11111",
pos="-29.317,-61.895",
shape=Mrecord,
style=filled,
width=3.0694];
7864288 → 7881249 [color="#00 00 00 40",
fontname=Helvetica,
label=“7.89%”,
lp=“4.6757,-21.508”,
pos=“e,-21.853,-38.845 -14.975,-19.864 -16.288,-23.431 -17.421,-26.526 -18.418,-29.266”];
}

PSA: the forum supports code blocks with Graphviz syntax highlighting:

```dot
digraph {
  like -> so[with="a label"];
}
```

which produces:

digraph {
  like -> so[with="a label"];
}

Indeed a mystery. After my own set of failures, here are two successes, both with the same input:

  • using a very recent version of neato [neato - graphviz version 2.47.2~dev.20210426.1530 (20210426.1530)] [does not work with dot - graphviz version 2.43.0 (0)]
  • using dot - graphviz version 2.43.0 (0) or newer

Note: I changed the direction of one of the edged - for dot


digraph G {
graph [
  fontname=Helvetica,
  overlap=false,
  splines=curved
];
edge[len=1.5]
node [label="\N"];

7864288 [fillcolor="#4EB1CB",
  group="X"
  fontcolor=black,
  fontname=Helvetica,
  label=" AVIVA xzxzx|NIP: 11111",
  shape=Mrecord,
  style=filled];
7879978 [fillcolor="#717ECD",
  group="X"
  fontcolor=black,
  fontname=Helvetica,
  label=" POLSKI KONCERN xzxzxzx|NIP: 111111",
  shape=Mrecord,
  style=filled];
//7864288 -> 7879978 [color="#00 00 00 40",
 7879978 -> 7864288 [color="#00 00 00 40",
dir=back  // changed
  fontname=Helvetica,
  label="6.29%"]
7881249 [fillcolor="#717ECD",
  fontcolor=black,
  group="X"
  fontname=Helvetica,
  label=" ENERGOMONTA xxzxzx|NIP: 11111",
  shape=Mrecord,
  style=filled];
7864288 -> 7881249 [color="#00 00 00 40",
  fontname=Helvetica,
  label="7.89%"];
}

neato produced:

dot produced:

When I use “dot” engine, my graph looks well (without any other changes), but it does not show edge labels… (and again - labels are in src, the viewers show it properly, just not the lib in ma app).
Anyway, the “fdp” works ok-ish (edges are very different in length, but at least all is visible), I will just stay with that for now.

Thank you Steveroush for your decent help !