We take a look at planer graphs (in particular at Euler's formula), and computer representations of graphs (adjacency matrices, adjacency lists).
A planer graph is one which can be drawn in two-dimensions so that its arcs intersect only in nodes.
To do: Practice #10, p. 341.
To do: Practice #12, p. 342.
Euler's Formula for simple, connected planer graphs states that
where n is the number of nodes, a is the number of arcs, and r is the number of regions (including the infinite region surrounding the graph).
Euler's formula is proven by induction, on a, the number of arcs.
To do: Practice #13, p. 342.
The following theorem provides some estimates on the relationship between the number of arcs and nodes that a planer graph may possess:
Theorem: For a simple, connected, planer graph with n nodes and a arcs,
From this theorem we can deduce that is not planer, since it has 5 nodes, and 10 arcs, and .
Also from this theorem we can deduce that is not planer, since it has 6 nodes, and 9 arcs, and no cycles of length 3: .
We want to examine two different representations of graphs by a computer:
An adjacency matrix for a graph with N nodes is NxN, where the rows and columns of the matrix represent the vertices. If the graph is undirected, then the element of the matrix is non-zero nodes i and j are adjacent; if directed, then the element of the matrix is non-zero there is an arc from node i to node j.
In our textbook, the element of the matrix , the number of arcs meeting the criteria above.
To do: Practice #16, p. 347.
For an undirected graph the adjacency matrix is symmetric (which means that we can reduce storage by about half); for a directed graph, the matrix may well be unsymmetric.
Here's a nice web page, with an example.
To do: Exercise #36, p. 357.
An adjacency list might be a better storage method for graphs with relatively few arcs: we effectively store only the non-zero entries of the adjacency matrix, in a linked list:
To do: Exercise #46, p. 358.
The redundency in drawing the adjacency list for an undirected graph is evident. This is eliminated for a directed graph:
To do: Exercise #57, p. 359.