Sunday, December 24, 2017

graphviz basic

1- different shape and style of dot file

1-

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



2-

  graph test123 {
               a -- b -- c;
               a -- {x y};
               x -- c [w=10.0];
               x -- y [w=5.0,len=3];
       }


3-

graph {
    a -- b[color=red,penwidth=3.0];
    b -- c;
    c -- d[color=red,penwidth=3.0];
    d -- e;
    e -- f;
    a -- d;
    b -- d[color=red,penwidth=3.0];
    c -- f[color=red,penwidth=3.0];
}



4-
 digraph R { rankdir=LR node [style=rounded] node1 [shape=box] node2 [fillcolor=yellow, style="rounded,filled", shape=diamond] node3 [shape=record, label="{ a | b | c }"] node1 -> node2 -> node3 }





2-  to generate graph from the dot file

$ dot -Tpng test1.dot -o graphname.png


- circular
$ circo -Tpng test1.dot -o circoGraph.pn


or other differrent type
sfdp
fdp
twopi
neato



3- or with interactive graph with xdot
$ xdot graph1.dot

No comments:

Post a Comment