I'm creating a switch topology with subgraphs.
How is below possible to re-organize so Bridge1 is on the top, Bridge2 is below, etc...
Thanks in advance!
I
It looks like your post is mostly code; please add some more details.
It looks like your post is mostly code; please add some more details.
It looks like your post is mostly code; please add some more details.
It looks like your post is mostly code; please add some more details.
It looks like your post is mostly code; please add some more details.
It looks like your post is mostly code; please add some more details.
It looks like your post is mostly code; please add some more details.
digraph G {
node [shape=box,style=filled];
newrank=True;
rankdir=TB;
subgraph cluster_1 {
label="Bridge1\n8001.5254aabbcce6";
rank=same;
rstp_1_1[label="port1\nD\n20000"];
rstp_1_2[label="port2\nR\n20000"];
rstp_1_3[label="port3\nD\n20000"];
rstp_1_4[label="port4\nD\n20000"];
}
subgraph cluster_2 {
label="Bridge2\n8001.5254aabbcca6";
rank=same;
rstp_2_1[label="port1\nD\n20000"];
rstp_2_2[label="port2\nD\n20000"];
rstp_2_3[label="port3\nD\n20000"];
rstp_2_4[label="port4\nR\n20000"];
}
subgraph cluster_3 {
label="Bridge3\n8001.5254aabbcc6c";
rank=same;
bgcolor=red;
rstp_3_1[label="port1\nD\n0"];
rstp_3_2[label="port2\nD\n0"];
rstp_3_3[label="port3\nD\n0"];
rstp_3_4[label="port4\nD\n0"];
}
subgraph cluster_4 {
label="Bridge4\n8001.5254aabbccba";
rank=same;
rstp_4_1[label="port1\nD\n20000"];
rstp_4_2[label="port2\nD\n20000"];
rstp_4_3[label="port3\nR\n20000"];
rstp_4_4[label="port4\nD\n20000"];
}
subgraph cluster_5 {
label="Bridge5\n8001.5254aabbccb2";
rank=same;
rstp_5_1[label="port1\nD\n20000"];
rstp_5_2[label="port2\nD\n20000"];
rstp_5_3[label="port3\nR\n20000"];
rstp_5_4[label="port4\nD\n20000"];
}
rstp_1_2 -> rstp_5_2 [arrowhead=none];
rstp_2_3 -> rstp_5_3 [arrowhead=none];
rstp_2_4 -> rstp_3_4 [arrowhead=none];
rstp_3_3 -> rstp_4_3 [arrowhead=none];
rstp_4_4 -> rstp_5_4 [arrowhead=none];
}
I have added below after rankdir=TB and it did the job:
rstp_1_1->rstp_2_1 [style=invis];
rstp_2_1->rstp_3_1 [style=invis];
rstp_3_1->rstp_4_1 [style=invis];
rstp_4_1->rstp_5_1 [style=invis];
rstp_5_1->rstp_6_1 [style=invis];
rstp_6_1->rstp_7_1 [style=invis];
rstp_7_1->rstp_8_1 [style=invis];
rstp_8_1->rstp_9_1 [style=invis];
rstp_9_1->rstp_10_1 [style=invis];
Problem
Similarly to this question (GraphViz - How to connect subgraphs?) I would like to connect some sub-graphs. Only this time I need to connect nested sub-graphs... Graphviz seems unhappy with my syntax.
Source
digraph G {
compound=true
subgraph cluster_family1 {
graph [ label="Family1"; ]
subgraph cluster_genus1 {
graph [ label="Genus1"; ]
species_1
species_2
}
subgraph cluster_genus2 {
graph [ label="Genus2"; ]
species_3
species_4
}
}
subgraph cluster_family2 {
graph [ label="Family2"; ]
subgraph cluster_genus2 {
graph [ label="Genus3"; ]
species_5
species_6
}
}
species_2 -> species_3 [ lhead=cluster_genus1 ] # TODO: Fix this line!!
}
The resulting diagram does not have the desired subgraph arrow pointing that I was hoping for. Instead I get the error:
dot -Tsvg source.dot -o output.svg
Warning: Two clusters named cluster_genus2 - the second will be ignored
Warning: species_2 -> species_3: head not inside head cluster cluster_genus1
Two bugs:
duplicate cluster names: (cluster_genus2)
confused heads & tails of your edge
You may want other tweaks, e.g if you want species_1 before species_2
digraph G {
compound=true
subgraph cluster_family1 {
graph [ label="Family1"; ]
subgraph cluster_genus1 {
graph [ label="Genus1"; ]
species_1
species_2
}
subgraph cluster_genus2 {
graph [ label="Genus2"; ]
species_3
species_4
}
}
subgraph cluster_family2 {
graph [ label="Family2"; ]
subgraph cluster_genus3 { // fixed duplicate name
graph [ label="Genus3"; ]
species_5
species_6
}
}
species_2 -> species_3 [ ltail=cluster_genus1 ] # changed head to tail??
}
Giving:
I am trying to inverse the position of two nodes (producción & funciones) that are inside a cluster (cluster_fp). Instead of producción on top and funciones at bottom, I need funciones on top and producción at bottom. How can I achieve that? They are in a cluster just because I thought it is the right approach, but probably it isn't. Because my reputation, I can't post images directly, so I leave the links to i.stack.imgur.com.
Code:
digraph tríada {
rankdir=LR;
edge [arrowhead=none];
label="* socialmente reconocido";
labeljust=left;
subgraph cluster_sinonimia_oa {
style=dashed;
label="sinonimia obra-texto";
subgraph cluster_texto {
style=striped;
label=texto;
selección [shape=rect];
}
obra [shape=rect, style=striped];
supuesto [label="supuesto\nexistencial", shape=plain];
}
subgraph cluster_autor {
style=striped;
label="autor*";
máquinas [shape=hexagon];
subgraph cluster_fp {
label="";
style=invis;
funciones [label="atribución o\napropiación", shape=plain];
producción [shape=plain];
}
subgraph cluster_sinonimia_nepa {
style=dashed;
label="sinonimia nombre-entidad-persona-autor";
personas [shape=hexagon];
entidad [shape=rect];
real [shape=diamond];
ficticia [shape=diamond];
nula [shape=diamond];
denotación [shape=plain];
nombre [shape=rect];
}
}
{personas máquinas} -> real [arrowhead=normal];
{real ficticia nula} -> entidad [arrowhead=normal];
nombre -> funciones -> obra -> supuesto -> selección -> producción -> entidad -> denotación -> nombre;
}
Live on dreampuf.github.io
Thanks!
Based on lots of experiments, the problem seems to be that dot's algorithm "weights" a multi-node edge more than a two-node edge.
Here is a much-edited input file that produces your desired output:
digraph tríada {
rankdir=LR;
edge [arrowhead=none];
label="* socialmente reconocido";
labeljust=left;
subgraph cluster_autor {
style=striped;
label="autor*";
subgraph cluster_sinonimia_nepa {
style=dashed;
label="sinonimia nombre-entidad-persona-autor";
personas [shape=hexagon];
entidad [shape=rect];
real [shape=diamond];
ficticia [shape=diamond];
nula [shape=diamond];
denotación [shape=plain];
nombre [shape=rect];
node [label="" shape=point width=.01]
// bogus1 & bogus2 are needed to flip/swap/invert the funciones & producción nodes
bogus1 bogus2
}
subgraph cluster_fp {
label="";
style=invis;
funciones [label="atribución o\napropiación", shape=plain];
producción [shape=plain];
}
máquinas [shape=hexagon];
{personas máquinas} -> real [arrowhead=normal];
{real ficticia nula} -> entidad [arrowhead=normal];
entidad -> denotación -> nombre
}
subgraph cluster_sinonimia_oa {
style=dashed;
label="sinonimia obra-texto";
subgraph cluster_texto {
style=striped;
label=texto;
selección [shape=rect];
}
obra [shape=rect, style=striped];
supuesto [label="supuesto\nexistencial", shape=plain];
}
nombre -> funciones -> obra -> supuesto -> selección
producción -> selección
entidad -> bogus1 [headclip=false ]
bogus1 -> bogus2 [tailclip=false, headclip=false]
bogus2 -> producción [tailclip=false]
}
(Yes, most of the edits were unnecessary)
I’ve been struggling for awhile on how to keep subgraph within rectangle instead of “Tetris” shapes when edge is being added and layout becomes more complex.
on Layer 2 in the codes below you’ll clearly notice “C”-shaped subgraph.
Is it possible to fix the subgraph’s shape ratio to rectangle as an ascii or any attribute to handle this?
digraph G {
subgraph cluster_0 {
subgraph cluster_3 {
label="Layer 3";
"3-1" -> "3-2" -> "3-3";
}
subgraph cluster_2 {
label="Layer 2";
"2-1" -> "2-2" -> "2-3";
}
subgraph cluster_1 {
label="Layer 1";
"1-1" -> "1-2" -> "1-3";
}
}
"1-1" -> "2-1";
"1-3" -> "2-1";
"1-1" -> "2-2";
"1-2" -> "2-2";
"1-2" -> "2-3";
"1-3" -> "2-3";
"2-1" -> {"3-1" "3-2"};
"2-3" -> {"3-1" "3-3"};
}
here is an img explanation:
.
I'm trying to create a flow control graph in graphviz, but I can't get the nodes to stay in the order. I tried prefixing them with a number as that is the only way I could get clusters to go in the right order (by trial an error), but this doesn't work for nodes.
I gave a weight of 100 to the nodes for ordering (which I intend to make invisible once they actually WORK) to no avail.
digraph G {
rankdir=LR;
splines=ortho;
subgraph cluster_I {
color=lightgrey;
style=filled;
label="Incoming Numbers";
newrank="true";
node [color=white,
style=filled];
"thisExtention" [color=lightskyblue1,
shape=square,
style="rounded, filled",
label="Extension 20"];
"+15412362468" [color=azure,
shape=rectangle,
style="rounded, filled"];
"+15412362468" -> "thisExtention" [tailport=e];
"+12069732753" [color=azure,
shape=rectangle,
style="rounded, filled"];
"+12069732753" -> "thisExtention" [tailport=e];
"+441134037186" [color=azure,
shape=rectangle,
style="rounded, filled"];
"+441134037186" -> "thisExtention" [tailport=e];
{
rank=same;
"+15412362468";
"+12069732753";
"+441134037186";
}
}
subgraph cluster_A {
color=blue;
subgraph cluster_1W {
color=lightgrey;
style=filled;
"actionstart" [label="Start Inbound Action Steps\n(can be interrupted by menu dial)"];
"thisExtention" -> "actionstart" [tailport=e];
}
subgraph cluster_2G {
color=aquamarine2;
style=filled;
"2if" [color=azure,
shape=diamond,
label="IF MENUKEY does equal 4"];
"3if" [color=azure,
shape=diamond,
label="IF SUM does equal 2\nAND INSIDE “BUSINESS HOURS”"];
"4ring" [color=azure,
shape=rectangle,
label="ring"];
"6playrecording" [color=azure,
shape=rectangle,
label="playrecording"];
}
subgraph cluster_3Y {
color=salmon1;
style=filled;
"7else" [color=azure,
shape=diamond,
label=ELSE];
"8playrecording" [color=azure,
shape=rectangle,
label="playrecording"];
}
subgraph cluster_W4 {
color=lightgrey;
style=filled;
"9transfer" [color=azure,
shape=rectangle,
label="transfer"];
}
subgraph cluster_5G {
color=aquamarine2;
style=filled;
"10else" [color=azure,
shape=diamond,
label=ELSE];
"11hangup" [color=azure,
shape=rectangle,
label="hangup"];
}
subgraph cluster_O {
color=lightgray;
style=filled;
label="Dial Menu";
"17ring" [color=azure,
shape=rectangle,
label="DIAL (#):\nring"];
"18set" [color=azure,
shape=rectangle,
label="DIAL ①:\nset"];
"19playrecording" [color=azure,
shape=rectangle,
label="DIAL ②:\nplayrecording"];
"20huntgroup" [color=azure,
shape=rectangle,
label="DIAL ③:\nRing HuntGroup: test hunt group"];
"21transfer" [color=azure,
shape=rectangle,
label="DIAL ④:\ntransfer"];
"22huntgroup" [color=azure,
shape=rectangle,
label="DIAL ⑤:\nRing HuntGroup: test hunt group"];
}
{
rank="same";
"actionstart";
"2if";
"3if";
"4ring";
"6playrecording";
"7else";
"8playrecording";
"9transfer";
"10else";
"11hangup";
"17ring";
"18set";
"19playrecording";
"20huntgroup";
"21transfer";
"22huntgroup";
}
"actionstart" -> "2if" [weight=100];
"2if" -> "3if" [weight=100];
"3if" -> "4ring" [weight=100];
"4ring" -> "6playrecording" [weight=100];
"6playrecording" -> "7else" [weight=100];
"7else" -> "8playrecording" [weight=100];
"8playrecording" -> "9transfer" [weight=100];
"9transfer" -> "10else" [weight=100];
"10else" -> "11hangup" [weight=100];
"11hangup" -> "17ring" [weight=100];
"17ring" -> "18set" [weight=100];
"18set" -> "19playrecording" [weight=100];
"19playrecording" -> "20huntgroup" [weight=100];
"20huntgroup" -> "21transfer" [weight=100];
"21transfer" -> "22huntgroup" [weight=100];
}
subgraph columnthree {
"Extension 10" [shape=square,
style="rounded, filled",
fillcolor=lightskyblue1];
"9transfer" -> "Extension 10" [weight=0,
tailport=e];
"HuntGroup 2" [shape=septagon,
style="filled",
fillcolor=lightcyan1];
"20huntgroup" -> "HuntGroup 2" [weight=0,
tailport=e];
"Extension 10" [shape=square,
style="rounded, filled",
fillcolor=lightskyblue1];
"21transfer" -> "Extension 10" [weight=0,
tailport=e];
"HuntGroup 2" [shape=septagon,
style="filled",
fillcolor=lightcyan1];
"22huntgroup" -> "HuntGroup 2" [weight=0,
tailport=e];
}
}