How to manage distance between nodes in graphviz? - graphviz

I am trying to plot a graph with 3 levels of nodes, with equal distances between the levels.
However, graphviz somehow decides that the distance between the middle level and the bottom one should be much larger than the distance between the top and middle level. Any way to fix this?
Here is my code:
digraph g{
rankdir="LR";
graph [pad="0.5", ranksep="0.525", nodesep="3"];
splines=false;
node[shape = square];
edge[style=invis];
subgraph cluster_3 {
color=invis;
a1->a2->a3->a4->a5->a6->a7;
}
subgraph cluster_2 {
color=invis;
a->b->c->d->e->f->g;
}
subgraph cluster_1 {
color=invis;
1->2->3->4->5->6->7;
}
"a1" [label="1'"];
"a2" [label="2'"];
"a3" [label="3'"];
"a4" [label="4'"];
"a5" [label="5'"];
"a6" [label="6'"];
"a7" [label="7'"];
edge[style=solid, constraint=false];
a->1[arrowhead=none, arrowtail=none];
a->2[arrowhead=none, arrowtail=none];
a->3[arrowhead=none, arrowtail=none];
a->a1[arrowhead=none, arrowtail=none];
a->a2[arrowhead=none, arrowtail=none];
a->a3[arrowhead=none, arrowtail=none];
b->1[arrowhead=none, arrowtail=none];
b->3[arrowhead=none, arrowtail=none];
b->7[arrowhead=none, arrowtail=none];
b->a1[arrowhead=none, arrowtail=none];
b->a3[arrowhead=none, arrowtail=none];
b->a7[arrowhead=none, arrowtail=none];
c->2[arrowhead=none, arrowtail=none];
c->6[arrowhead=none, arrowtail=none];
c->7[arrowhead=none, arrowtail=none];
c->a2[arrowhead=none, arrowtail=none];
c->a6[arrowhead=none, arrowtail=none];
c->a7[arrowhead=none, arrowtail=none];
d->1[arrowhead=none, arrowtail=none];
d->4[arrowhead=none, arrowtail=none];
d->7[arrowhead=none, arrowtail=none];
d->a1[arrowhead=none, arrowtail=none];
d->a4[arrowhead=none, arrowtail=none];
d->a7[arrowhead=none, arrowtail=none];
e->1[arrowhead=none, arrowtail=none];
e->2[arrowhead=none, arrowtail=none];
e->3[arrowhead=none, arrowtail=none];
e->a1[arrowhead=none, arrowtail=none];
e->a2[arrowhead=none, arrowtail=none];
e->a3[arrowhead=none, arrowtail=none];
f->1[arrowhead=none, arrowtail=none];
f->4[arrowhead=none, arrowtail=none];
f->7[arrowhead=none, arrowtail=none];
f->a1[arrowhead=none, arrowtail=none];
f->a4[arrowhead=none, arrowtail=none];
f->a7[arrowhead=none, arrowtail=none];
g->5[arrowhead=none, arrowtail=none];
g->6[arrowhead=none, arrowtail=none];
g->7[arrowhead=none, arrowtail=none];
g->a5[arrowhead=none, arrowtail=none];
g->a6[arrowhead=none, arrowtail=none];
g->a7[arrowhead=none, arrowtail=none];
}
The output looks like this currently:

Just played around a bit and came up with the below graph, is this any closer to want to want?
digraph g{
graph [pad="0.5", nodesep="1", ranksep="2"];
splines="false";
node[shape = square];
edge[style=invis];
a1->a->1
a2->b->2
a3->c->3
a4->d->4
a5->e->5
a6->f->6
a7->g->7
"a1" [label="1'"];
"a2" [label="2'"];
"a3" [label="3'"];
"a4" [label="4'"];
"a5" [label="5'"];
"a6" [label="6'"];
"a7" [label="7'"];
edge[style=solid, constraint=false];
a->1[arrowhead=none, arrowtail=none];
a->2[arrowhead=none, arrowtail=none];
a->3[arrowhead=none, arrowtail=none];
a->a1[arrowhead=none, arrowtail=none];
a->a2[arrowhead=none, arrowtail=none];
a->a3[arrowhead=none, arrowtail=none];
b->1[arrowhead=none, arrowtail=none];
b->3[arrowhead=none, arrowtail=none];
b->7[arrowhead=none, arrowtail=none];
b->a1[arrowhead=none, arrowtail=none];
b->a3[arrowhead=none, arrowtail=none];
b->a7[arrowhead=none, arrowtail=none];
c->2[arrowhead=none, arrowtail=none];
c->6[arrowhead=none, arrowtail=none];
c->7[arrowhead=none, arrowtail=none];
c->a2[arrowhead=none, arrowtail=none];
c->a6[arrowhead=none, arrowtail=none];
c->a7[arrowhead=none, arrowtail=none];
d->1[arrowhead=none, arrowtail=none];
d->4[arrowhead=none, arrowtail=none];
d->7[arrowhead=none, arrowtail=none];
d->a1[arrowhead=none, arrowtail=none];
d->a4[arrowhead=none, arrowtail=none];
d->a7[arrowhead=none, arrowtail=none];
e->1[arrowhead=none, arrowtail=none];
e->2[arrowhead=none, arrowtail=none];
e->3[arrowhead=none, arrowtail=none];
e->a1[arrowhead=none, arrowtail=none];
e->a2[arrowhead=none, arrowtail=none];
e->a3[arrowhead=none, arrowtail=none];
f->1[arrowhead=none, arrowtail=none];
f->4[arrowhead=none, arrowtail=none];
f->7[arrowhead=none, arrowtail=none];
f->a1[arrowhead=none, arrowtail=none];
f->a4[arrowhead=none, arrowtail=none];
f->a7[arrowhead=none, arrowtail=none];
g->5[arrowhead=none, arrowtail=none];
g->6[arrowhead=none, arrowtail=none];
g->7[arrowhead=none, arrowtail=none];
g->a5[arrowhead=none, arrowtail=none];
g->a6[arrowhead=none, arrowtail=none];
g->a7[arrowhead=none, arrowtail=none];
}

To add to #uncletall answer (and partially address #ingomueller.net question), it looks like the nodesep and ranksep have big factors in how the nodes will be separated:
http://www.graphviz.org/doc/info/attrs.html#d:nodesep
nodesep : double, default: 0.25, minimum: 0.02 In dot, nodesep
specifies the minimum space between two adjacent nodes in the same
rank, in inches.
For other layouts, nodesep affects the spacing between loops on a
single node, or multiedges between a pair of nodes.
Valid for: Graphs.
http://martin-loetzsch.de/S-DOT/ranksep.html
The gives desired rank separation, in inches. This is the minimum
vertical distance between the bottom of the nodes in one rank and the
tops of nodes in the next.

Related

DOT graph from superstate to substate

I'd like to generate the DOT code to draw the equivalent state machine diagram shown.
I going to be created programmatically, I've got the transitions between states and superstates done. ButI need a bit of help with this:
This gives me an initial transition, but the State1 should be the cluster:
digraph {
compound=true;
node [shape=Mrecord]
rankdir="LR"
subgraph clusterOpen
{
label = "State1"
State2
}
State1 -> State2 [style="solid"];
node [shape = point label="" ] i ->State1
}
Normally Graphviz programs try hard to avoid placing nodes on top of other nodes. But you can place nodes anywhere you like if you explicitly provide a pos attribute for each node (see https://graphviz.org/faq/#FaqDotWithNodeCoords).
The program that creates your input files should calculate a pos attribute for each node. (Remember that pos coordinates are in points, while node sizes are in inches!). You can probably skip calculating the splines for the edges and just let neato do that.
This program:
digraph {
graph [bb="0,0,482.8,337"];
node [label="\N"];
State1 [height=4.0139,
label="{State 1|\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n}",
pos="162,144.5",
shape=Mrecord,
width=4.5];
State2 [height=1.3333,
label="{State 2|\n\n\n\n}",
// pos="403,144.5",
pos="220,88",
shape=Mrecord,
width=1.6944];
xp3 [height=0.05,
label="",
// pos="429,331",
pos="0,194",
shape=point,
// style=dotted,
style=invis,
width=0.05];
r1 [height=0.16667,
label="",
// pos="455,331",
pos="154,194",
shape=square,
width=0.16667];
xp4 [height=0.05,
label="",
// pos="481,331",
pos="0,88",
shape=point,
// style=dotted,
style=invis,
width=0.05];
xp1 [height=0.16,
label="",
pos="162,331",
shape=point,
width=0.16];
xp1 -> State1:n [pos="e,162,288.5 162,325.23 162,319.09 162,308.89 162,298.63",
style=dashed];
xp2 [height=0.16,
label="",
// pos="403,331",
pos="220,194",
shape=point,
width=0.16];
xp2 -> State2:n [pos="e,403,192.5 403,325.19 403,307.39 403,251.8 403,202.57"];
// manually added:
xp3 -> r1 [label="Trigger 1" dir=none ]
xp4 -> State2 [label="Trigger 2" ]
}
Run with this command line:
neato -n -Tpng stateDiagram.dot >stateDiagram.png
Produces this graph:

In Graphviz, how to layout subgraphs in different orientations?

There is rankdir for the global graph which sets the orientation of the layout. What about subgraph or cluster - is there a way to have one subgraph in TD layout and another subgraph in BT?
How to achieve the graph in the attached image with following (incorrect) code?
digraph G {
subgraph cluster0 {
rankdir="TD";
A; B;
A -> B;
}
subgraph cluster1 {
rankdir="BT"; // this doesn't produce the desired output
C; D;
D -> C;
}
}
You cannot do that, rankdir is only allowed at top level (graph)
but in simple cases you can work around it by
to go in opposite direction:
C->D[dir=back]
to go in to the side:
{rank=same C D}

how do I add arbitrary, positioned, text/symbols to a graphviz diagram?

I would like to have an "implies" arrow between the two graphs here
digraph G {
subgraph case {
x;
left [shape=diamond];
right [shape=diamond];
left -> x;
right -> x;
}
subgraph case_ {
x_;
left_ [shape=diamond];
right_ [shape=diamond];
left_ -> x_;
right_ -> x_;
}
}
Trying to GraphViz - How to connect subgraphs? doesn't work because I'm using the dot algorithm. But I don't need anything too fancy since I have a bunch of diagrams like this where there is a "before" and "after" state and I want to put some visual indicator.

Graphviz crossing edges

I am trying to avoid the crossing of the lines between 20->40 and 30->70. Does anyone know how to do this? I am using single points to straighten out the edges but I would have expected the rendering engine to avoid these edges to overlap. Here is my dot code:
digraph {
graph [splines="ortho", nodesep = "1", overlap = false];
node [shape=rectangle, color=lightgrey, style=filled ];
10
20
30
40
50
60
70
80
90
node[shape=none, width=0, height=0 label=""];
edge[dir=none];
{rank=same;
p1->10
10->p2
}
p1->20
p2->30
{rank=same;
p3->40
40->p4
}
p3->50
p4->60
{rank=same;
p5->70
70->p6
}
p5->80
p6->90
20->40
30->70
}
I wanted to post an image, but stackoverflow does not allow me to do this... You can see what I mean when you copy the code into: http://stamm-wilbrandt.de/GraphvizFiddle/
I really appreciate your help on this!
You could give graphviz a hint by adding an invisible edge between p4 an dp5:
{
rank=same;
p3 -> 40;
40 -> p4;
p4 -> p5 [style=invis]; // new invisible edge
p5 -> 70;
70 -> p6;
}
If you are not able to add invisible edges (dynamic graph generation), make sure nodes which are part of a subgraph do appear first within the subgraph, and therefore avoid upfront node definitions.
In this example, I removed the node definitions in the beginning of the script and inlined the style of the elbow-joint nodes.
Here's the GraphvizFiddle
digraph {
graph [splines="ortho", nodesep = "1", overlap = false];
node [shape=rectangle, color=lightgrey, style=filled ];
//node[shape=none, width=0, height=0, label=""];
edge[dir=none];
{
rank=same;
p1[shape=none, width=0, height=0, label=""];
p2[shape=none, width=0, height=0, label=""];
p1->10
10->p2
}
p1->20
p2->30
{
rank=same;
p3[shape=none, width=0, height=0, label=""];
p4[shape=none, width=0, height=0, label=""];
p3->40
40->p4
}
p3->50
p4->60
{
rank=same;
p5[shape=none, width=0, height=0, label=""];
p6[shape=none, width=0, height=0, label=""];
p5->70
70->p6
}
p5->80
p6->90
20->40
30->70
}

graphviz overlap=ortho: horizontal layout

I've got an undirected graph made by graphviz tools (now i'm using sfdp):
digraph structs {
node [shape=Mrecord, URL="index_new.php?object=\N&overlap=false"];
overlap = orthoxy;
bgcolor=transparent;
splines=true;
rankdir=TB;
node [fontname="Arial", fontsize=30, style=filled, fillcolor=chartreuse1, image="../common/img/monitor.png"]struct_swbposad91 [label = "sw-bposad9-1\n192.168.17.141\nC2960 "];
node [fontname="Arial", fontsize=30, style=filled, fillcolor=chartreuse1, image="../common/img/monitor.png"]struct_swmedikov5fan [label = "sw-medikov5-fan\n192.168.34.134\n "];
node [fontname="Arial", fontsize=30, style=filled, fillcolor=chartreuse1, image="../common/img/monitor.png"]struct_swlevash131 [label = "sw-levash13-1\n192.168.16.165\nC2960 "];
node [fontname="Arial", fontsize=30, style=filled, fillcolor=deepskyblue]struct_swpolevsabirov45a [label = "sw-polevsabirov45a\n192.168.18.182\nS2300 "];
...lots of lines goes here...
struct_swkazan71:f450212->struct_swbmorsk181:f450213 [weight=1.2, dir=both, color=black, penwidth=5, arrowhead="empty", arrowtail="odot"];
struct_swmikh171:f450222->struct_swbotk151:f450223 [weight=1.2, dir=both, color=black, penwidth=1, arrowhead="empty", arrowtail="odot"];
...lots of lines goes here...
here is full code: http://pastebin.com/P3MKTCm2 (it's really large, sorry)
and the output is like this one: (part)
Problem: i need my graph to grow horizontaly instead of verticaly. Is there any way to get the layout like the one on the image, but "rotated" 90 degrees?
A couple of observations made while trying to make something out of the graph:
The graph is not big, but the markup sure is redundant - I applied a little love and removed them so one can actually read it (see below)
The ports used for the edges do not exist and graphviz generates a load of warnings. While the output is still generated, this is certainly not a good thing.
This is a directed graph - digraph and -> are used for directed graphs.
overlap=orthoxy seems to be deprecated:
The remaining allowed values of overlap correspond to algorithms
which, at present, can produce bad aspect ratios. In addition, we
deprecate the use of the "ortho*" and "portho*".
Below the output when simply using overlap=false with sfdp, ignoring all warnings and the missing images:
digraph structs {
overlap=false;
bgcolor=transparent;
splines=true;
rankdir=TB;
node [shape=Mrecord, URL="index_new.php?object=\N&overlap=false", fontname="Arial", fontsize=30, style=filled, fillcolor=chartreuse1, image="../common/img/monitor.png"];
struct_swbposad91 [label = "sw-bposad9-1\n192.168.17.141\nC2960 "];
struct_swmedikov5fan [label = "sw-medikov5-fan\n192.168.34.134\n "];
struct_swlevash131 [label = "sw-levash13-1\n192.168.16.165\nC2960 "];
struct_swkant121 [label = "sw-kant12-1\n192.168.19.9\nC3400 "];
struct_swpolit91 [label = "sw-polit9-1\n192.168.18.102\n8012M "];
struct_swbotk151 [label = "sw-botk15-1\n192.168.18.36\nC2960 "];
struct_swmikh171 [label = "sw-mikh17-1\n192.168.18.37\nC2950 "];
struct_swchapaeva17 [label = "sw-chapaeva17\n192.168.17.136\n8000S "];
struct_swsamp871 [label = "sw-samp87-1\n192.168.19.7\nC2960 "];
struct_swlig291 [label = "sw-lig29-1\n192.168.39.133\nC2960 "];
struct_swbotk152 [label = "sw-botk15-2\n192.168.19.119\nC2960 "];
struct_swkubin842 [label = "sw-kubin84-2\n192.168.31.131\nI2110A "];
struct_swpugacheva571 [label = "sw-pugacheva5/7-1\n192.168.37.144\nI2110A "];
struct_swbposad92 [label = "sw-bposad9-2\n192.168.17.142\nC3550 "];
struct_swkapitolk177 [label = "sw-kapitol-k177\n192.168.40.134\n "];
struct_swkapitolk338 [label = "sw-kapitol-k338\n192.168.40.131\n "];
struct_swbmorsk181 [label = "sw-bmorsk18-1\n192.168.29.132\nC2960 "];
struct_swpirog171 [label = "sw-pirog17-1\n192.168.18.40\nSuperStack "];
struct_swkazan71 [label = "sw-kazan7-1\n192.168.19.228\nC2960 "];
struct_cskazac9brd [label = "cs-kazac9-brd\n192.168.30.251\nCASR1002F "];
struct_swgrib1261 [label = "sw-grib126-1\n192.168.19.235\nC2960 "];
struct_swlenin1391 [label = "sw-lenin139-1\n192.168.31.144\nC2960 "];
struct_swpirog151 [label = "sw-pirog15-1\n192.168.18.42\nI2110A "];
struct_swrastr21 [label = "sw-rastr2-1\n192.168.36.130\nC2960 "];
struct_swkazac92 [label = "sw-kazac9-2\n192.168.17.163\nC2960 "];
struct_swsmolen331 [label = "sw-smolen33-1\n192.168.17.108\nC2950 "];
struct_swkubin841 [label = "sw-kubin84-1\n192.168.31.134\nS2300 "];
struct_swkurskaya40 [label = "sw-kurskaya40\n192.168.26.144\nI2110A "];
struct_swvolkov171 [label = "sw-volkov17-1\n192.168.17.167\nC2960 "];
struct_swtall71 [label = "sw-tall7-1\n192.168.37.147\nC2960 "];
struct_swlevash132 [label = "sw-levash13-2\n192.168.16.174\n8000S "];
struct_swpetrovkosa11 [label = "sw-petrovkosa1-1\n192.168.16.164\nC2950 "];
struct_swobuh120e1 [label = "sw-obuh120e-1\n192.168.21.131\nC2960 "];
struct_swkurch101 [label = "sw-kurch10-1\n192.168.18.104\nC2960 "];
struct_swsamp873 [label = "sw-samp87-3\n192.168.19.57\nC2960 "];
struct_swengelsa291 [label = "sw-engelsa29-1\n192.168.18.163\nC2960 "];
struct_swsamp681 [label = "sw-samp68-1\n192.168.19.4\nC2950 "];
struct_swsamp421 [label = "sw-samp42-1\n192.168.19.2\nS2300 "];
struct_swbelovod71 [label = "sw-belovod7-1\n192.168.19.12\nS2300 "];
struct_swoktyabr381 [label = "sw-oktyabr38-1\n192.168.37.149\n8000S "];
struct_swural11 [label = "sw-ural1-1\n192.168.28.144\nI2110A "];
struct_swsamp68style [label = "sw-samp68-style\n192.168.19.10\n8012M "];
struct_swrevol69 [label = "sw-revol69\n192.168.37.141\n "];
struct_swlig292 [label = "sw-lig29-2\n192.168.39.134\nSuperStack "];
struct_swkolom331 [label = "sw-kolom33-1\n192.168.18.181\nC2950 "];
struct_swchernigov15 [label = "sw-chernigov15\n192.168.26.133\nI2110A "];
struct_swVO9line344 [label = "sw-VO9line34-4\n192.168.28.142\nI2110A "];
struct_swbmorsk182 [label = "sw-bmorsk18-2\n192.168.29.133\nC2960 "];
struct_swdom41 [label = "sw-dom4-1\n192.168.18.226\nC2960 "];
struct_swnevsky301 [label = "sw-nevsky30-1\n192.168.27.135\nC2960 "];
struct_swobuh116k11 [label = "sw-obuh116k1-1\n192.168.21.132\n "];
struct_swkapitol1 [label = "sw-kapitol-1\n192.168.40.145\n "];
node [fontname="Arial", fontsize=30, style=filled, fillcolor=deepskyblue];
struct_swpolevsabirov45a [label = "sw-polevsabirov45a\n192.168.18.182\nS2300 "];
struct_swvarshav111 [label = "sw-varshav11-1\n192.168.20.46\nSuperStack "];
struct_swtrefol2opor [label = "sw-trefol2-opor\n192.168.31.142\nC2960 "];
node [fontname="Arial", fontsize=30, style=filled, fillcolor=yellow];
struct_swVO9line341 [label = "sw-VO9line34-1\n192.168.28.137\nC2960 "];
struct_swkazac91 [label = "sw-kazac9-1\n192.168.17.104\nC2960 "];
struct_swVO9line345 [label = "sw-VO9line34-5\n192.168.28.143\nI2924GF "];
struct_swmagn17a2 [label = "sw-magn17a-2\n192.168.37.133\nSuperStack "];
struct_swpopova23gajot [label = "sw-popova23-gajot\n192.168.34.133\nC3400 "];
struct_swVO9line343 [label = "sw-VO9line34-3\n192.168.28.138\nC3400 "];
struct_swmagnit17a1 [label = "sw-magnit17a-1\n192.168.37.130\nC2960 "];
struct_swknipovich41 [label = "sw-knipovich4-1\n192.168.39.139\nI2126A "];
edge[weight=1.2, dir=both, color=black, penwidth=1, arrowhead="empty", arrowtail="odot"];
struct_swtrefol2opor:f450155->struct_swvarshav111:f450156 [color=red, penwidth=5];
struct_swkazan71:f450212->struct_swbmorsk181:f450213 [penwidth=5];
struct_swmikh171:f450222->struct_swbotk151:f450223;
struct_swpirog171:f450230->struct_swbotk151:f450231;
struct_swbotk152:f450232->struct_swbotk151:f450233;
struct_swoktyabr381:f450262->struct_swtall71:f450263;
struct_swvarshav111:f450291->struct_swlenin1391:f450292;
struct_swkazac92:f450313->struct_swkazac91:f450314;
struct_swkazac91:f450321->struct_swkazan71:f450322 [penwidth=5];
struct_swgrib1261:f450323->struct_swkazan71:f450324;
struct_cskazac9brd:f450333->struct_swkazac91:f450334;
struct_swlenin1391:f450335->struct_swkazan71:f450336 [penwidth=5];
struct_cskazac9brd:f450345->struct_swkazac91:f450346;
struct_swsmolen331:f450347->struct_swkazac91:f450348;
struct_swbotk151:f450349->struct_swkazac91:f450350 [penwidth=5];
struct_cskazac9brd:f450351->struct_swkazac91:f450352;
struct_swrastr21:f450361->struct_swkazac91:f450362 [penwidth=5];
struct_swlenin1391:f450363->struct_swkazac91:f450364 [penwidth=5];
struct_swpirog151:f450379->struct_swpirog171:f450380;
struct_swkurskaya40:f450383->struct_swvolkov171:f450384;
struct_swkubin841:f450389->struct_swlenin1391:f450390;
struct_swkubin842:f450403->struct_swkubin841:f450404;
struct_swVO9line345:f450431->struct_swbposad91:f450432;
struct_swbposad92:f450435->struct_swbposad91:f450436;
struct_swchapaeva17:f450441->struct_swbposad92:f450442;
struct_swmedikov5fan:f450453->struct_swbposad91:f450454 [penwidth=5];
struct_swbposad91:f450469->struct_swsamp871:f450470 [penwidth=5];
struct_swdom41:f450473->struct_swsamp871:f450474 [penwidth=5];
struct_swkurch101:f450477->struct_swsamp871:f450478;
struct_swsamp873:f450479->struct_swsamp871:f450480;
struct_swbposad91:f450487->struct_swsamp871:f450488 [penwidth=5];
struct_swkant121:f450491->struct_swsamp871:f450492;
struct_swpolit91:f450493->struct_swsamp871:f450494;
struct_swengelsa291:f450495->struct_swsamp871:f450496 [penwidth=5];
struct_swsamp681:f450497->struct_swsamp871:f450498;
struct_swsamp421:f450499->struct_swsamp871:f450500;
struct_swrastr21:f450539->struct_swbotk151:f450540 [penwidth=5];
struct_swpolevsabirov45a:f450605->struct_swkolom331:f450606;
struct_swbelovod71:f450613->struct_swsamp421:f450614;
struct_swpopova23gajot:f450630->struct_swmedikov5fan:f450631;
struct_swural11:f450636->struct_swVO9line345:f450637;
struct_swlig291:f450652->struct_swkazac91:f450653 [penwidth=5];
struct_swmagn17a2:f450657->struct_swmagnit17a1:f450658;
struct_swlevash132:f450674->struct_swlevash131:f450675;
struct_swmedikov5fan:f450678->struct_swlevash131:f450679 [penwidth=5];
struct_swpetrovkosa11:f450686->struct_swlevash131:f450687;
struct_swobuh120e1:f450711->struct_swmagnit17a1:f450712 [penwidth=5];
struct_swtall71:f450713->struct_swmagnit17a1:f450714;
struct_swpugacheva571:f450721->struct_swmagnit17a1:f450722;
struct_swobuh120e1:f450751->struct_swlig291:f450752 [penwidth=5];
struct_swlig292:f450757->struct_swlig291:f450758;
struct_swknipovich41:f450763->struct_swlig291:f450764;
struct_swsamp68style:f450777->struct_swsamp681:f450778;
struct_swrevol69:f450781->struct_swmagnit17a1:f450782;
struct_swchernigov15:f450827->struct_swsmolen331:f450828;
struct_swvolkov171:f450835->struct_swsmolen331:f450836;
struct_swobuh116k11:f450852->struct_swobuh120e1:f450853;
struct_swmagnit17a1:f450926->struct_swbotk151:f450927 [penwidth=5];
struct_swnevsky301:f450932->struct_swkazan71:f450933;
struct_swbmorsk182:f450948->struct_swbmorsk181:f450949;
struct_swkazan71:f450952->struct_swbmorsk181:f450953 [penwidth=5];
struct_swbmorsk181:f450972->struct_swVO9line341:f450973 [penwidth=5];
struct_swVO9line344:f450986->struct_swVO9line341:f450987;
struct_swVO9line343:f450994->struct_swVO9line341:f450995 [color=Red, penwidth=5];
struct_swbmorsk181:f450998->struct_swVO9line341:f450999 [penwidth=5];
struct_swlevash131:f451004->struct_swVO9line341:f451005 [penwidth=5];
struct_swkapitolk177:f451031->struct_swkapitol1:f451032;
struct_swkapitolk338:f451033->struct_swkapitol1:f451034;
struct_swkolom331:f451084->struct_swengelsa291:f451085;
struct_swdom41:f451086->struct_swengelsa291:f451087 [penwidth=5];
struct_swVO9line345:f451139->struct_swVO9line341:f451140;
struct_swsamp871:f451157->struct_swbotk151:f451158 [penwidth=5];
struct_swVO9line345:f451161->struct_swVO9line341:f451162;
struct_swbotk151:f451177->struct_swkazac91:f451178 [penwidth=5];
struct_swsamp871:f451184->struct_swbotk151:f451185 [penwidth=5];
struct_swkazac91:f451186->struct_swkazan71:f451187 [penwidth=5];
struct_swVO9line345:f451190->struct_swbposad91:f451191;
}
And here the same with dot:
Have you tried using [rankdir=TB] ?
http://www.graphviz.org/doc/info/attrs.html#d:rankdir
There may be something that I am missing, because rankdir=TB should be the default. Your sample graph appears to have rankdir=LR, but you didn't mention specifying it. (Also your graph looks like a directed graph, but you indicated undirected.)

Resources