Graphviz is a great tool for visualizing graphs, especially trees and dags (but not doges). We'll be using Graphviz in class for examples, so here's a quick primer:

At a high level, a Graphviz input file contains descriptions of nodes and edges. Nodes have this basic syntax:


which tells Graphviz to draw the node ID with label LABEL. Edges have this basic syntax:

ID1 -> ID2;

which tells Graphviz to draw an edge from the node with id ID1 to the node with id ID2. The description of your graph's edges and nodes should appear between curly braces after the digraph keyword:

digraph {

Note that you can freely mix node and edge descriptions.

For a simple example, we can graph the student life:

digraph {
  1 -> 2;
  2 -> 3;
  3 -> 1;

which we can save in a file and render with the dot command:

$ dot -Tpng > life.png

yielding this nice image:

For more on getting the most out of dot, check the dot user guide.