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

2

8

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 :)

Proctology answered 11/6, 2012 at 10:25 Comment(0)
C
19

You were almost there:

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

does what you're looking for.

Caston answered 11/6, 2012 at 12:20 Comment(1)
But I want the edges share the label, not display one label every edge. How to get it? I cannot find a solution. Thanks!Carswell
N
4

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;
}
Napier answered 30/12, 2014 at 16:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.