dot and graph

  1. graphviz
  2. dot filetype, undirected and directed graph
  3. dot command
  4. installation on Windows

graphviz

Graphviz is a open source visualization software. dot is a common command line of Graphviz suite. In COMP9024 of UNSW, we learn how to use dot to make directed or undirected graph.

dot filetype, undirected and directed graph

The .dot file format is used for defining graphs in a plain text language known as DOT language.

undirected graph:

graph OurGraph {
    A -- B;
    B -- C;
    C -- A;
}

directed graph:

digraph OurDirectedGraph {
    A -> B;
    B -> C;
    C -> A;
}

In COMP9024, the lectures and tutors like to make the vertices redundent clarification in dot file:

graph OurUndirectedGraph {
"0" -- {"2"}
"0" -- {"3"}
"0" -- {"4"}
"1" -- {"2"}
"1" -- {"5"}
"2" -- {"4"}
"2" -- {"5"}
"2" -- {"6"}
"6" -- {"7"}
"0"
"1"
"2"
"3"
"4"
"5"
"6"
"7"
}
graph OurUndirectedGraph {
"0" -- {"2"}
"0" -- {"3"}
"0" -- {"4"}
"1" -- {"2"}
"1" -- {"5"}
"2" -- {"4"}
"2" -- {"5"}
"2" -- {"6"}
"6" -- {"7"}
"0"
"1"
"2"
"3"
"4"
"5"
"6"
"7"
}

dot command

dot -T png images/OurUndirectedGraph_0000.dot -o images/OurUndirectedGraph_0000.png

# dot: This is the Graphviz command-line tool used to process DOT files.

# -T png: Specifies the output format, in this case, PNG (portable network graphics). Graphviz supports other formats like SVG, PDF, and JPEG.

# images/OurUndirectedGraph_0000.dot: This is the path to the input DOT file, which contains the graph definition.

# -o images/OurUndirectedGraph_0000.png: Specifies the output file path and name for the generated image.

installation on Windows

link: http://www.graphviz.org/download/


Welcome to point out the mistakes and faults!