Skip to content

Latest commit

 

History

History
58 lines (43 loc) · 1018 Bytes

graphviz.markdown

File metadata and controls

58 lines (43 loc) · 1018 Bytes

Graphviz

Simple graph

Put the following lines to simple.gv

graph simple
{
    a -- b --c;
    b -- d;
}

generate a graph using dot

dot -Tpng -O simple.gv
ls
# simple.gv  simple.gv.png

Simple graph

Use -> for edges in directional graph:

digraph simple
{
    a -> b -> c;
    b -> d;
}

Graph with attributes

digraph loop
{
    graph [bgcolor="#000000", label="A Loop", fontcolor="white"];

    a [color="green", label="start", fontcolor="white"];
    b [shape="circle", color="green", fontcolor="white"];
    c [shape="circle", color="green", fontcolor="white"];
    d [shape="circle", color="green", fontcolor="white"];
    e [shape="circle", color="green", fontcolor="white"];

    a -> b -> c -> d -> e [color="yellow", arrowhead="open"];
    e -> a [color="yellow", arrowhead="open", style="bold"];
}

result image:

a loop