a diagram consisting of a finite collection of points linked by line segments or arcs
graph (formal definition)
an ordered pair \((V,E)\text{,}\) where \(V\) is a finite set and \(E\) is a finite, unordered list of subsets of \(V\text{,}\) each of which has exactly \(1\) or \(2\) elements
vertex
a point in a graph (i.e. an element of \(V\))
node
synonym for vertex
edge
a line or arc linking two vertices (i.e. an element of \(E\))
empty graph
the graph \((\emptyset,\emptyset)\text{,}\) with no vertices and no edges
Warning14.1.1.
The list \(E\) is not a set, since duplicate entries in this list have a graphical meaning; see below.
An element \(e \in E\) represents an edge as follows. If \(e\) consists of exactly two elements of \(V\text{,}\) draw a line between these two vertices. If \(e\) consists of exactly one element of \(V\text{,}\) draw a line from this vertex to itself.
Example14.1.2.A very basic graph.
The graph \(G = (V,E)\text{,}\) where
\begin{align*}
V \amp = \{ v_1, v_2, v_3 \}, \amp
E \amp = \bigl\{ \{v_1,v_2\}, \{v_1,v_3\}, \{v_2,v_3\} \bigr\},
\end{align*}
has three vertices and three edges.
Example14.1.4.A slightly more complicated example graph.
Worked Example14.1.6.Using a graph to solve a problem.
Suppose we have jugs \(A,B,C\) with capacities \(8,5,3\) litres, respectively. Jug \(A\) is full of water and jugs \(B,C\) are empty. Can we divide the water into two exactly equal parts? If so, find the most efficient pouring sequence.
Construct a graph with points labelled by elements \((a,b,c) \in \N \times \N \times \N\text{,}\) where \(a,b,c\) are the volumes of water in jugs \(A,B,C\text{,}\) respectively. Join two points with a line segment if we can obtain one set of volumes from the other in a single pour. We will ignore pours that return us to a configuration previously achievable by fewer pours.
Following the left leg of the graph gets us to the desired configuration in \(7\) pours.