Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

shorthand for having multiple edges (from different nodes) to one node with same label

Tags:

graphviz

dot

I know I can do something like

a -> z [label="XXX"];
b -> z [label="XXX"];
c -> z [label="XXX"];
d -> z [label="XXX"];

But is there a way to do something like

a,b,c,d -> z [label="XXX"];

with same output as the code above? It would really make my dot source simpler :)

like image 532
rezna Avatar asked Jun 11 '12 10:06

rezna


2 Answers

You were almost there:

{a;b;c;d} -> z [label="XXX"];

does what you're looking for.

like image 188
marapet Avatar answered Oct 16 '22 23:10

marapet


To reply to your comment, here's how you distribute a label (or color or other attribute) across multiple edges:

subgraph
{
    edge [label="Hello"];
    {a,b,c,d} -- z;
}
like image 29
spraff Avatar answered Oct 16 '22 23:10

spraff