Rank Same with Edges
Panda-Sharp opened this issue · comments
HI,
Is it possible to achieve something like this in a single line of code?
{rank=same; b1 -> b2 -> b3};
currently the only way I found to achieve the same result is like this:
graph.Subgraphs.AddWithNodes(DotRank.Same, b1.Tag, b2.Tag, b3.Tag);
graph.Edges.Add(b1.Tag, b2.Tag);
graph.Edges.Add(b2.Tag, b3.Tag);
that genrates this:
{ rank = same b1 b2 b3 }
b1 -> b2
b2 -> b3
Thanks!
Hello!
You can try this:
graph.Subgraphs.Add(DotRank.Same, subgraph =>
{
subgraph.Edges.AddSequence("b1", "b2", "b3");
});
and if you want to have the subgraph as a single line, specify adequate formatting options
var script = graph.Build(new DotFormattingOptions
{
Subgraphs = { SingleLine = true }
});
digraph
{
{ rank = same b1 -> b2 -> b3 }
}
Cheers!