Simo
Simo

Reputation: 25

polylines edges when using ports graphviz

I am using Graphviz to create a graph with nodes that are HTML-like labels. My dot file:

digraph 0 {
   center = true
   charset = "UTF-8"
   overlap = false
   splines = true
   landscape = false
   id = "0"
   label = "Graph Example"
   labelloc = "t"

node [shape = none width = 0 height = 0 margin = 0 fontcolor = blue ]

0 [ label = <
    <TABLE BORDER = "0" CELLBORDER = "1" CELLSPACING = "0" CELLPADDING = "5" ALIGN = "CENTER" BGCOLOR = "white" COLOR = "black" >
        <TR>
            <TD PORT = "0" >Node 0</TD>
        </TR>
        <TR>
            <TD CELLSPACING = "0" CELLPADDING = "0" >
                <TABLE BORDER = "0" CELLSPACING = "1" CELLBORDER = "0" CELLPADDING = "0" >
                <TR>
                    <TD PORT = "4">   </TD>
                    <TD PORT = "1">   </TD>
                    <TD PORT = "2">   </TD>
                    <TD PORT = "3">   </TD>
                    <TD PORT = "6">   </TD>
                </TR>
                </TABLE>
            </TD>
        </TR>
    </TABLE> > ]

4 [ label = <
    <TABLE BORDER = "0" CELLBORDER = "1" CELLSPACING = "0" CELLPADDING = "5" ALIGN = "CENTER" BGCOLOR = "white" COLOR = "black" >
        <TR>
            <TD PORT = "4" >Node 1</TD>
        </TR>
        <TR>
            <TD CELLSPACING = "0" CELLPADDING = "0" >
                <TABLE BORDER = "0" CELLSPACING = "1" CELLBORDER = "0" CELLPADDING = "0" >
                <TR>
                    <TD PORT = "6">   </TD>
                </TR>
                </TABLE>
            </TD>
        </TR>
    </TABLE> > ]

6 [ label = <
    <TABLE BORDER = "0" CELLBORDER = "1" CELLSPACING = "0" CELLPADDING = "5" ALIGN = "CENTER" BGCOLOR = "white" COLOR = "black" >
        <TR>
            <TD PORT = "6" >Node 6</TD>
        </TR>

    </TABLE> > ]

1 [ label = <
    <TABLE BORDER = "0" CELLBORDER = "1" CELLSPACING = "0" CELLPADDING = "5" ALIGN = "CENTER" BGCOLOR = "white" COLOR = "black" >
        <TR>
            <TD PORT = "1">Node 1</TD>
        </TR>
        <TR>
            <TD CELLSPACING = "0" CELLPADDING = "0" >
                <TABLE BORDER = "0" CELLSPACING = "1" CELLBORDER = "0" CELLPADDING = "0" >
                <TR>
                    <TD PORT = "4">   </TD>
                </TR>
                </TABLE>
            </TD>
        </TR>
    </TABLE> > ]

2 [ label = <
    <TABLE BORDER = "0" CELLBORDER = "1" CELLSPACING = "0" CELLPADDING = "5" ALIGN = "CENTER" BGCOLOR = "white" COLOR = "black" >
        <TR>
            <TD PORT = "2">Node 2</TD>
        </TR>
        <TR>
            <TD CELLSPACING = "0" CELLPADDING = "0" >                   
                <TABLE BORDER = "0" CELLSPACING = "1" CELLBORDER = "0" CELLPADDING = "0" >
                    <TR>
                        <TD PORT = "4">   </TD>
                        <TD PORT = "5">   </TD>
                    </TR>
                </TABLE>
            </TD>
        </TR>
    </TABLE> > ]

5 [ label = <
    <TABLE BORDER = "0" CELLBORDER = "1" CELLSPACING = "0" CELLPADDING = "5" ALIGN = "CENTER" BGCOLOR = "white" COLOR = "black" >
        <TR>
            <TD PORT = "5" >Node 5</TD>
        </TR>

    </TABLE> > ]

3 [ label = <
    <TABLE BORDER = "0" CELLBORDER = "1" CELLSPACING = "0" CELLPADDING = "5" ALIGN = "CENTER" BGCOLOR = "white" COLOR = "black" >
        <TR>
            <TD PORT = "3" >Node 3</TD>
        </TR>
        <TR>
            <TD CELLSPACING = "0" CELLPADDING = "0" >                   
                <TABLE BORDER = "0" CELLSPACING = "1" CELLBORDER = "0" CELLPADDING = "0" >
                    <TR>
                        <TD PORT = "5">   </TD>
                    </TR>
                </TABLE>                        
            </TD>
        </TR>
    </TABLE> > ]

1:4:s -> 4:4:n
2:4:s -> 4:4:n
2:5:s -> 5:5:n
0:1:s -> 1:1:n
0:2:s -> 2:2:n
0:3:s -> 3:3:n
0:6:s -> 6:6:n

4:6:s -> 6:6:n
3:5:s -> 5:5:n
0:4:s -> 4:4:n

edge [color = red constraint = false ]

1:1 -> 4:4
1:1 -> 3:3

}

And I am using ports to define where on the node I want to connect with other nodes. Attached the image generated by dot.

I would like to have the edges drawn as polylines instead of curved arcs. I tried to modify the splines attribute for the graph but it does not work, in fact from the graphviz documentation I found this: "The value ortho specifies edges should be routed as polylines of axis-aligned segments. Currently, the routing does not handle ports or, in dot, edge labels."

Can you help in finding a solution to have polylines (or better looking edges) using ports?

Thanks.

Upvotes: 1

Views: 1414

Answers (1)

Daniel
Daniel

Reputation: 581

simply change:

splines = true

to

splines = polyline

did the trick for me

result

Upvotes: 1

Related Questions