Tools

Examples

From about-Graphviz (and many more examples):

digraph D {

  A [shape=diamond]
  B [shape=box]
  C [shape=circle]

  A -> B [style=dashed, color=grey]
  A -> C [color="black:invis:black"]
  A -> D [penwidth=5, arrowhead=none]

}

Fake cell for better formatting:

digraph
{
    /* layout */
    // node width to create space for longer labels
    node [ width = 1.75 ];
    { rank=same; a; b; c }

    /* nodes */
    t [ label = "TOP", shape = doublecircle, width = 1];
    a [ label = "short" ];
    b [ label = "medium" ];
    c [ label = "rather  l o n g"]
    // invisible nodes to 're-route' the edges
    x [ style = invis, shape = point, width = 0 ];
    y [ style = invis, shape = point, width = 0 ];

    /* edges */
    t -> t;
    t -> { a b c }
    t -> { a b c } [dir = back ];      // added for reverse arrows
    a -> b -> c -> b -> a;
    a:nw -> a:sw;
    c:ne -> c:se;
    b:s -> b:s;
    // put the invisible nodes at the desired places with invisible edges
    b -> x -> y [ style = invis ];
    // edges to invisible nodes must not have heads
    c:sw -> x [ arrowhead = "none" ];
    x -> a:se;
    a:s ->  y [ arrowhead = "none" ];
    y -> c:s;
}

Commands

Everything starts with: digraph or graph (not directional).

Cluster

If a subgraph name starts with cluster then will be drawn with its own rectangle layout.

Attributes:

Node

Rank

Any of:

Shape

Group

For forcing vertical alignment. See https://stackoverflow.com/questions/43599738/graphviz-alignment-of-subgraph https://stackoverflow.com/questions/1554635/graphviz-how-to-have-a-subgraph-be-left-to-right-when-main-graph-is-top-to-bot

Edge

Label

label
taillabel
headlabel

Port

node:s -> node1:n
node -> node1 [tailport=n, headport=s]

Cluster end

To draw outside of cluster border:

c -> g [ltail=cluster0, lhead=cluster1]

Arrow shapes

See list

Documentation

MyWiki: graphviz (last edited 2018-11-17 23:39:21 by risca)