Graph

From Wikisophia
Jump to: navigation, search

Wikitex

Contents

Graphviz

Graphviz by Lefty Koutsofios, et al.; for relational diagrams (doc | template). Examples from the Graphviz gallery. Oversize/problematic examples on separate pages.

hello world

digraph G {Hello->World}
<graph>

digraph G {Hello->World} </graph>

process - buggy / contraints?

<graph>graph G { 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; }</graph>

Cluster

<graph> 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]; }</graph>

intranet

<graph>strict graph ip_map { MH -- { ERC ALC WH1 HO1 IH1 }; ALC -- MV -- AN; MV -- HO3 -- WH1; HO3 -- MT; MT -- LZ -- FL; MT -- FJ; MT -- ER; HO1 -- HR; MT -- DR; HO1 -- CB -- IH1 -- IHC; HO1 -- HV; {IHP IW IH1 IH2 IH4 } -- {IHP IW IH1 IH2 IH4 }; {IH4 IH2} -- {MLM HV}; HO1 -- HO3; HO3 -- IH1; IH2 -- IH4 [len=4]; // hack }</graph>

fdp cluster

Take a look at the new "fdp" layout:

<graph layout="fdp">
graph G
{
  e
  subgraph clusterA
  {
    a -- b;
    subgraph clusterC
    {
      C -- D;
    }
  }
  subgraph clusterB
  {
    d -- f
  }
  d -- D
  e -- clusterB
  clusterC -- clusterB
}   
</graph>
<graph layout="fdp">

graph G {

 e
 subgraph clusterA
 {
   a -- b;
   subgraph clusterC
   {
     C -- D;
   }
 }
 subgraph clusterB
 {
   d -- f
 }
 d -- D
 e -- clusterB
 clusterC -- clusterB

} </graph>

Entity relation

<graph layout="neato">
graph ER
{
 node [fontsize=12];
 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";
}
</graph>
<graph layout="neato">

graph ER {

node [fontsize=12];
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";

} </graph>

Ling

AVM and Parsetrees have been superseded by <graph>.

Attribute-Value Matrices

AVM by Christopher Manning for attribute-value matrices (doc | template);

<ling> \newbox\matrixsynsem \newbox\headdtr \newbox\compdtrone \newbox\compdtrtwo {\scriptsize \avmoptions{center} \setbox\matrixsynsem=\hbox{\begin{avm} \osort{synsem}{\[local & \[cat & \[ \] \\ content & \[ \]\]\]} \end{avm}} \setbox\headdtr=\hbox{\begin{avm} \osort{word}{\[ phon\;\<\rm likes\>\\ synsem\;\[local\[ cat\;\[ head \; \@{5}\\ arg-s\;\< \@{1},\@{2}\>\] \\ content\;\@{6} \]\]\]} \end{avm}} \setbox\compdtrone=\hbox{\begin{avm} \sort{phrase}{\[ phon\;\<\rm fido\>\\ synsem\;\@{1}\;\[local\[ cat\;\[ head\;noun\\ arg-s\;\< \>\] \\ content\;\@{3} \]\]\]} \end{avm}} \setbox\compdtrtwo=\hbox{\begin{avm} \sort{phrase}{\[ phon\;\<\rm bones\>\\ synsem\;\@{2}\;\[local\[ cat\;\[ head\;noun\\ arg-s\;\< \>\] \\ content\;\@{4} \]\]\]} \end{avm}} \avmoptions{active,sorted} \begin{avm} \hspace{-1in} [{phrase} phon\;\<\rm fido likes bones\> \\ synsem\;[{synsem} local [{} cat & [{} head & @{5}\\ arg-s & \< \; \>] \\ content & @{6}[{psoa} reln\;like \\ arg1\;@{3} \\ arg2\;@{4} ]]]\\ dtrs\;\sort{head-struc}{[{} head-dtr\;\box\headdtr \\ comp-dtrs\;< \box\compdtrone , \\ \hspace{.5in} \box\compdtrtwo>]}] \end{avm}} </ling>

Parsetrees

Parsetree by Eirik Hektoen for semantic trees (doc):

<ling> \ptbegtree \ptbeg \npile{S\\ see' (s, k)\\ \lambda y see' ( y,k ) (s)} \ptbeg \npile{NP\\s} \npile{Sam\\s} \ptend \ptbeg \npile{VP\\ \lambda y see' ( y,k )\\ \lambda x \lambda y see' ( y,x ) (k)} \ptbeg \npile{V\\ \lambda x \lambda y see' ( y,x ) } \npile{saw\\ \lambda x \lambda y see ( y,x )} \ptend \ptbeg \npile{NP\\k} \npile{Kim\\k} \ptend \ptend \ptend \ptendtree </ling>
Personal tools