orderGraphviz - fixed subgraphs

2019-03-03 10:18发布

问题:

I like to create a 3 column graph like this:

Code:

digraph g {
rankdir="LR";
node[shape = circle, fontsize=14];
fontsize=18;
labeljust="l";

{ rank=same;
}

edge[style=invis, fontsize=12];
subgraph clusterA {
    a->b;
    label="A";
}
subgraph clusterC {
  e->f->g;
    label="C";
}

subgraph clusterB {
 c->d;
label="B";
}

}

I want to create a graph with the subgraphs A,C,B ordering. How can I add relations to this graph (ex. c->f; and b->g;) without the remaining the order of A--C--B?

回答1:

You may try adding the edges which are not supposed to influence the layout with constraint=false. After the last cluster, insert something like:

edge[constraint=false, style=solid];
c->f;
b->g;

If the clusters get reordered anyway, you may add invisible edges (make sure that constraint=true) to enforce the layout:

c -> e [constraint=true, style=invis];
e -> a [constraint=true, style=invis];


标签: graphviz dot