Graphviz is the open source package used to create the graphical representation by writing the scripts.
Dot language is to create hierarchical graph
Neato language is to create the circular graph
In order to create the horizontal graph, use the graph attribute
graph [ rankdir=LR]
Compilation
To generate the Post script file
dot -Tps inputfilename.gv -o outputfilename.ps
To generate the jpeg output
dot –Tjpeg inputfilename.gv -o outputfilename.jpeg
Edges:
Edges are created by 🡪 operator
Attributes
Size:
Size = “4,4”;
Sets the size of the image in inches
Shapes
Default: eclipse, width=0.75, height=0.5
To change shape of all the node, change the node attribute
node [shape = box]
Box
Plaintext
Draws the text without any outline
Polygon
Eclipse
Point
Egg
Triangle
Diamond
Trapezium
Parallelogram
hexagon
octagon
doublecircle
tripleoctagon
invtriangle
invtrapezium
Label:
Default node label is its name
Edges are unlabelled by default.
Multi line labels
It is created by the escape sequence
\n 🡪 centered
\l 🡪 left justified
\r 🡪 right justified
Default Font: 14 point, Times new roman, black
You can give the label to the graph and subgraph .
label = “Network Topology Diagram”
Label position
Default 🡪 Centered below graph
labelloc=”t” 🡪 places the label on top
labelloc=”b” 🡪 places the label on bottom
Label Justification
labeljust=”r” 🡪 right justification
labeljust=”l” 🡪 left justification
Edges
// Single line comments
/* */ multiple line comments same as C programming
by adding a command rankdir. Rankdir takes four possible options
LR, RL, TB, and BT, for Left to Right, Right to Left, Top to Bottom
and Bottom to Top, respectively
| Default Values | Attributes |
Size | 14 | fontsize |
Name | Times-Roman | fontname |
Color | Black | fontcolor |
\n | Center Justified |
\l | Left justified |
\r | Right justified |
Make_string [label=”make a \n string”];
node [color=Red,fontname=Courier,shape=box]
All nodes after this line will have above shape and colour
edge [color=Blue, style=dashed] //All the lines look like this
Node Shape
Other shapes
Box
Circle
Plaintext 🡪 without the outline
Record
S0 -> S1 [ label = "Lift Nozzle" ]
Size of the Node depends on
nodesep=1.0 // increases the separation between nodes in horizontal direction
ranksep=2.0 // Changes the distance between nodes in vertical direction
Orientation
rotate=90 is set, or orientation=landscape ,