mirageglobe
mirageglobe

Reputation: 3094

create fixed edge directional graphs in dot format with graphviz

Is there anyway to create defined fixed edges directional graphs using dot notation? the following dot notation (fig 2) generates an automated edges that are curved. It doesnt have notations which will generate directions with straight edges (fig 1). Been on hours trying to find anything close, any hints will be great. thank you.

# fig 1

box A --- box B
 |.  \
 |.   \
box C. \
       box D
# fig 2

digraph G {
    node [shape=record];
    
    rankdir="BT"
    a -> b              [color = red][arrowhead = diamond][taillabel = "tail"]
    b -> c              [shape = box]
    c -> a
}

directedgraph

Upvotes: 0

Views: 69

Answers (1)

sroush
sroush

Reputation: 6763

Not sure what a fixed edge is, but if you don't want splines for edges, look at the splines attribute (https://graphviz.org/docs/attrs/splines/).
Here is you graph with splines=false. You can also try splines=polyline.
You might also connect the edges to specific ports on one or both of the nodes (https://graphviz.org/docs/attr-types/portPos/).

# fig 2

digraph G {
    node [shape=record];
    // see https://graphviz.org/docs/attrs/splines/
    // also look at ports  https://graphviz.org/docs/attr-types/portPos/
    splines=false  // or try splines=polyline

    rankdir="BT"
    a -> b              [color = red][arrowhead = diamond][taillabel = "tail"]
    b -> c              [shape = box]
    c -> a
}

Giving:
enter image description here

Upvotes: 1

Related Questions