Graph layouting via Graphviz
Problem:
You want to display a Graph.
Solution:
Create a simple text file describing your graph and save it with a .dot
file extension:
graph {
node1 -- node2;
node2 -- node3;
node3 -- node4;
node4 -- node1;
}
Afterwards you can use a program of the graphviz package (sudo apt-get install graphviz
) in order to visualize the graph. This package contains different layouting programs like dot
, neato
, fdp
(all from the GraphViz project) etc. Simply call one of these programs in order to visualize the graph:
neato -Tsvg yourFile.dot -o outputFile.svg
Output from this command: