Graphviz

Материал из NikiWiki
Перейти к:навигация, поиск
YourBunnyWroute.pngАвтор предупреждает! Статья не дописана!
Данная статья не дописана и требует до- или, даже, переработки. Примеры и данные в этой статье могут быть не проверены, тесты не отлажены, а информация не действительна. Я постараюсь, чтобы таких статей было по-меньше, но пока они есть. Смотрите: NikiWiki:Отказ от ответственности


Example 1

<graphviz border='frame' format='png'>

digraph example1 {Hello->World!}

</graphviz>

Example 2

<graphviz renderer='neato' caption='Hello Neato'> graph EXAMPLE2 {

  run -- intr;
  intr -- runbl;
  runbl -- run;
  run -- kernel;
  kernel -- zombie;
  kernel -- sleep;
  kernel -- runmem;
  sleep -- swap;
  swap -- runswap;
  runswap -- new;
  runswap -- runmem;
  new -- runmem;
  sleep -- runmem;

} </graphviz>

Example 3

<graphviz caption='Hello SVG and PNG' alt='phylogenetic tree' format='png'> digraph G {

               node [shape=plaintext];
               Mollusca [URL="Mollusca"];
               Neomeniomorpha [URL="Neomeniomorpha"];
               X1 [shape=point,label=""];
               Caudofoveata [URL="Caudofoveata"];
               Testaria [URL="Testaria"];
               Polyplacophora [URL="Polyplacophora"];
               Conchifera [URL="Conchifera"];
               Tryblidiida [URL="Tryblidiida"];
               Ganglioneura [URL="Ganglioneura"];
               Bivalvia [URL="Bivalvia"];
               X2 [shape=point,label=""];
               X3 [shape=point,label=""];
               Scaphopoda [URL="Scaphopoda"];
               Cephalopoda [URL="Cephalopoda"];
               Gastropoda [URL="Gastropoda"];
               Mollusca->X1->Testaria->Conchifera->Ganglioneura->X2->Gastropoda
               Mollusca->Neomeniomorpha
               X1->Caudofoveata
               Testaria->Polyplacophora
               Conchifera->Tryblidiida
               Ganglioneura ->Bivalvia
               X2->X3->Cephalopoda
               X3->Scaphopoda

} </graphviz>

Example 4

<graphviz border='frame' format='png'> digraph g { graph [ rankdir = "LR" ]; node [ fontsize = "16" shape = "ellipse" ]; edge [ ]; "node0" [ label = "<f0> 0x10ba8| <f1>" shape = "record" ]; "node1" [ label = "<f0> 0xf7fc4380| <f1> | <f2> |-1" shape = "record" ]; "node2" [ label = "<f0> 0xf7fc44b8| | |2" shape = "record" ]; "node3" [ label = "<f0> 3.43322790286038071e-06|44.79998779296875|0" shape = "record" ]; "node4" [ label = "<f0> 0xf7fc4380| <f1> | <f2> |2" shape = "record" ]; "node5" [ label = "<f0> (nil)| | |-1" shape = "record" ]; "node6" [ label = "<f0> 0xf7fc4380| <f1> | <f2> |1" shape = "record" ]; "node7" [ label = "<f0> 0xf7fc4380| <f1> | <f2> |2" shape = "record" ]; "node8" [ label = "<f0> (nil)| | |-1" shape = "record" ]; "node9" [ label = "<f0> (nil)| | |-1" shape = "record" ]; "node10" [ label = "<f0> (nil)| <f1> | <f2> |-1" shape = "record" ]; "node11" [ label = "<f0> (nil)| <f1> | <f2> |-1" shape = "record" ]; "node12" [ label = "<f0> 0xf7fc43e0| | |1" shape = "record" ]; "node0":f0 -> "node1":f0 [ id = 0 ]; "node0":f1 -> "node2":f0 [ id = 1 ]; "node1":f0 -> "node3":f0 [ id = 2 ]; "node1":f1 -> "node4":f0 [ id = 3 ]; "node1":f2 -> "node5":f0 [ id = 4 ]; "node4":f0 -> "node3":f0 [ id = 5 ]; "node4":f1 -> "node6":f0 [ id = 6 ]; "node4":f2 -> "node10":f0 [ id = 7 ]; "node6":f0 -> "node3":f0 [ id = 8 ]; "node6":f1 -> "node7":f0 [ id = 9 ]; "node6":f2 -> "node9":f0 [ id = 10 ]; "node7":f0 -> "node3":f0 [ id = 11 ]; "node7":f1 -> "node1":f0 [ id = 12 ]; "node7":f2 -> "node8":f0 [ id = 13 ]; "node10":f1 -> "node11":f0 [ id = 14 ]; "node10":f2 -> "node12":f0 [ id = 15 ]; "node11":f2 -> "node1":f0 [ id = 16 ]; } </graphviz>

Example 5

<graphviz border='frame' format='png'>

    1. "It encodes the so-called philosophers dilemma. Neato pretty much approximates the way how humans would layout the graph." Contributed by Manfred Jeusfield.
    2. Command to generate the layout: "neato -Tpng thisfile > thisfile.png"


digraph PhiloDilemma { node [shape=box]; bec3; rel3; bec2; rel2; acq2; acq3; bec1; rel1; acq1; node [shape=circle,fixedsize=true,width=0.9]; hu3; th3; ri3; ea3; hu2; th2; ri2; ea2; hu1; th1; ri1; ea1; ri3->acq2; ri3->acq3; hu3->acq3; bec3->hu3; th3->bec3; rel3->th3; rel3->ri3; ea3->rel3; acq3->ea3; ri2->acq1; ri2->acq2; hu2->acq2; bec2->hu2; th2->bec2; rel2->th2; rel2->ri2; ea2->rel2; acq2->ea2; ri1->acq3; ri1->acq1; hu1->acq1; bec1->hu1; th1->bec1; rel1->th1; rel1->ri1; ea1->rel1; acq1->ea1;

overlap=false label="PetriNet Model PhiloDilemma\nExtracted from ConceptBase and layed out by Graphviz " fontsize=12; } </graphviz>


Example 6

<graphviz border='frame' format='png'>

graph ER { node [shape=box]; course; institute; student; node [shape=ellipse]; {node [label="name"] name0; name1; name2;} code; grade; number; node [shape=diamond,style=filled,color=lightgrey]; "C-I"; "S-C"; "S-I";

name0 -- course; code -- course; course -- "C-I" [label="n",len=1.00]; "C-I" -- institute [label="1",len=1.00]; institute -- name1; institute -- "S-I" [label="1",len=1.00]; "S-I" -- student [label="n",len=1.00]; student -- grade; student -- name2; student -- number; student -- "S-C" [label="m",len=1.00]; "S-C" -- course [label="n",len=1.00];

label = "\n\nEntity Relation Diagram\ndrawn by NEATO"; fontsize=20; } </graphviz>

Example 7

<graphviz border='frame' format='png'> digraph G {

subgraph cluster_0 { style=filled; color=lightgrey; node [style=filled,color=white]; a0 -> a1 -> a2 -> a3; label = "process #1"; }

subgraph cluster_1 { node [style=filled]; b0 -> b1 -> b2 -> b3; label = "process #2"; color=blue } start -> a0; start -> b0; a1 -> b3; b2 -> a3; a3 -> a0; a3 -> end; b3 -> end;

start [shape=Mdiamond]; end [shape=Msquare]; } </graphviz>