alignment - Vertically aligning a node joining subgraphs in Graphviz -


i give following input dot:

digraph g {   subgraph cluster1 {     fontsize = 20;     label = "group 1";     -> b -> c -> d;     style = "dashed";   }    subgraph {     o [shape=box];   }    subgraph cluster2 {     fontsize = 20;     label = "group 2";     z -> y -> x -> w [dir=back];     style = "dashed";   }    d -> o [constraint=false];   w -> o [constraint=false, dir=back]; } 

and produces:

picture node o aligned , z

how can align node o has same rank d , w? is, graph looks like:

a   z |   | b   y |   | c   x |   | d-o-w 

adding

 { rank=same; d; o; w; } 

yields error

warning: d in rankset, ignored in cluster g warning: w in rankset, ignored in cluster g 

i'm thinking can hack adding invisible nodes , edges subgraph of o, wondering if missing dot magic.

you use approach rankdir=lr , use constraint=false edges inside clusters:

digraph g {   rankdir=lr;    subgraph cluster1 {     fontsize = 20;     label = "group 1";     rank=same;     -> b -> c -> d [constraint=false];     style = "dashed";   }    subgraph cluster2 {     fontsize = 20;     label = "group 2";     rank=same;     z -> y -> x -> w [dir=back, constraint=false];     style = "dashed";   }    o [shape=box];   d -> o -> w; } 

it's not dot magic :-), achieves this:

graphviz output rankdir lr

hacking invisible nodes work:

digraph g {   subgraph cluster1 {     fontsize = 20;     label = "group 1";     -> b -> c -> d;     style = "dashed";   }    subgraph {     o1[style=invis];     o2[style=invis];     o3[style=invis];     o [shape=box];      o1 -> o2 -> o3 -> o [style=invis];   }    subgraph cluster2 {     fontsize = 20;     label = "group 2";     z -> y -> x -> w [dir=back];     style = "dashed";   }    edge[constraint=false];   d -> o -> w; } 

the result identical:

graphviz output invisible nodes


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -