Reputation: 163
How do I create the following graph with the graphviz c-library:
digraph G {
{rank=same; n1, n2}
n1 -> n2 -> n3;
}
The following lines are clear:
g = agopen("G", AGFLAG_DIRECTED);
agnode(g, "n1");
agnode(g, "n2");
agnode(g, "n3");
agedge(g, "n1", "n2");
agedge(g, "n2", "n3");
How do I rank n1 and n2?
Upvotes: 3
Views: 819
Reputation: 163
I've found a solution. The braces gave me the hint.
{rank=same; n1, n2}
It must be a subgraph. So the following lines will do the trick:
Agraph_t *sub = agsubg(g, "");
agsafeset(sub, "rank", "same", "");
Upvotes: 4