adding labels to connection points

hi everyone,

i've been given a task to visualize the connections between all our network-switches.
Basically, I have a table that looks something like this:

| src-switch | src-port | dst-switch | dst-port |
|switch1 |12 |switch4 |31 |
|switch2 |14 |switch6 |37 |
|switch3 |19 |switch1 |32 |
|switch1 |22 |switch2 |13 |
|switch3 |44 |switch4 |1 |
|switch5 |41 |switch3 |13 |

visualizing the connections between the switches is pretty easy:

graph G {

switch1 -- switch2;
switch2 -- switch3;
switch3 -- switch1;
switch1 -- switch5;
switch5 -- switch2;
}

But how do I display the Switch-Ports on my image? (like on the attached file)

Thank a lot!

AttachmentSize
graph.png18.74 KB

Use headlabel and

Use headlabel and taillabel:

graph G {

switch1 -- switch3 [taillabel=12 headlabel=14];
switch1 -- switch2 [taillabel=1 headlabel=6];
switch1 -- switch5 [taillabel=44 headlabel=47];
switch3 -- switch2 [taillabel=50 headlabel=9];
switch5 -- switch2 [taillabel=44 headlabel=34];
}

 

Alternatively, you could make the ports part of the nodes using HTML-like labels. http://www.graphviz.org/content/node-shapes#html

Recent comments