Simple square layouts seem to elude neato's stress majorization

I would have expected a square from four equal-length edges, as illustrated by the following Bash input:

neato -Tpng -o IfSquare.png << END_INPUT
graph G {
node [label=“” xlabel=“\N” shape=circle height=0.05 width=0.05];
A – B [len=1.00000]
B – C [len=1.00000]
C – D [len=1.00000]
D – A [len=1.00000]
}
END_INPUT

I get a very strange tangle (I will try to “upload” the image to this post). If stress majorization is (colloquially) Kamada-Kawai 2.0, how can it be so easily confused?

IfSquare

(I don’t know why neato is so easily confused, but I am stressed (majorly!) and often confused.)
Anyway, I ran your graph (with minor tweaks) through neato with many model & mode options and this is what I got:

1 Like

Thanks, Steve. I do need either KK or stress majorization (which is already happening, as you said, albeit not in the intended manner). The length metric for each edge comes from a rather elaborate calculation of similarity, and the relative layout distances have to be as close as possible. Hierarchy should not enter into it.