Chapter 10: Graph Theory
Discrete Mathematical Structures:
Theory and Applications
10
Discrete Mathematical Structures: Theory and Applications 2
Learning Objectives
Learn the basic properties of graph theory
Learn about walks, trails, paths, circuits, and cycles in a graph
Explore how graphs are represented in computer memory
Learn about Euler and Hamilton circuits
Learn about isomorphism of graphs
Explore various graph algorithms
Examine planar graphs and graph coloring
10
Discrete Mathematical Structures: Theory and Applications 3
Graph Definitions and Notation
The Königsberg bridge problem is as follows: Starting at one land area, is it possible to walk across all of the bridges exactly once and return to the starting land area?
In 1736, Euler represented the Königsberg bridge problem as a graph, as shown in Figure 10.1(b), and answered the question in the negative.
10
Discrete Mathematical Structures: Theory and Applications 4
Graph Definitions and Notation
Consider the following problem related to an old children’s game. Using a pencil, can each of the diagrams in Figure 10.2 be traced, satisfying the following conditions?
1. The tracing must start at point A and come back to point A.
2. While tracing the figure, the pencil cannot be lifted from the figure.
3. A line cannot be traced twice.
As in geometry, each of points A, B, and C is called a vertex of the graph and the line joining two vertices is called an edge.
10
Discrete Mathematical Structures: Theory and Applications 5
Graph Definitions and Notation
The services are to be connected subject to the following condition: The pipes must be laid so that they do not cross each other. Consider three distinct points, A, B, C, as three houses and three other distinct points, W , T, and E, which represent the water source, the telephone connection point, and the electricity connection point.
Suppose there are three houses, which are to be connected to three services — water, telephone, and electricity — by means of underground pipelines.
10
Discrete Mathematical Structures: Theory and Applications 6
Graph Definitions and Notation
Try to join W , T, and E with each of A, B, and C by drawing lines (they may not be straight lines) so that no two lines intersect each other (see Figure 10.3).
This is known as the three utilities problem.
10
Discrete Mathematical Structures: Theory and Applications 7
Graph Definitions and Notation
10
Discrete Mathematical Structures: Theory and Applications 8
Graph Definitions and Notation
10
Discrete Mathematical Structures: Theory and Applications 9
Graph Definitions and Notation
10
Discrete Mathematical Structures: Theory and Applications 10
Graph Definitions and Notation
10
Discrete Mathematical Structures: Theory and Applications 11
Graph Definitions and Notation
10
Discrete Mathematical Structures: Theory and Applications 12
Graph Definitions and Notation
10
Discrete Mathematical Structures: Theory and Applications 13
Graph Definitions and Notation
10
Discrete Mathematical Structures: Theory and Applications 14
Graph Definitions and Notation
10
Discrete Mathematical Structures: Theory and Applications 15
Graph Definitions and Notation
10
Discrete Mathematical Structures: Theory and Applications 16
Graph Definitions and Notation
10
Discrete Mathematical Structures: Theory and Applications 17
Graph Definitions and Notation
10
Discrete Mathematical Structures: Theory and Applications 18
Graph Definitions and Notation
10
Discrete Mathematical Structures: Theory and Applications 19
Graph Definitions and Notation
10
Discrete Mathematical Structures: Theory and Applications 20
Walks, Paths, and Cycles
10
Discrete Mathematical Structures: Theory and Applications 21
Walks, Paths, and Cycles
10
Discrete Mathematical Structures: Theory and Applications 22
Walks, Paths, and Cycles
10
Discrete Mathematical Structures: Theory and Applications 23
Walks, Paths, and Cycles
10
Discrete Mathematical Structures: Theory and Applications 24
Walks, Paths, and Cycles
10
Discrete Mathematical Structures: Theory and Applications 25
Walks, Paths, and Cycles
10
Discrete Mathematical Structures: Theory and Applications 26
Walks, Paths, and Cycles
10
Discrete Mathematical Structures: Theory and Applications 27
Walks, Paths, and Cycles
10
Discrete Mathematical Structures: Theory and Applications 28
Walks, Paths, and Cycles
10
Discrete Mathematical Structures: Theory and Applications 29
Walks, Paths, and Cycles
10
Discrete Mathematical Structures: Theory and Applications 30
Matrix Representation of a Graph
10
Discrete Mathematical Structures: Theory and Applications 31
Matrix Representation of a Graph
10
Discrete Mathematical Structures: Theory and Applications 32
Matrix Representation of a Graph
10
Discrete Mathematical Structures: Theory and Applications 33
10
Discrete Mathematical Structures: Theory and Applications 34
10
Discrete Mathematical Structures: Theory and Applications 35
Matrix Representation of a Graph
10
Discrete Mathematical Structures: Theory and Applications 36
Matrix Representation of a Graph
10
Discrete Mathematical Structures: Theory and Applications 37
Matrix Representation of a Graph
10
Discrete Mathematical Structures: Theory and Applications 38
Special Circuits
10
Discrete Mathematical Structures: Theory and Applications 39
Special Circuits
10
Discrete Mathematical Structures: Theory and Applications 40
Special Circuits
10
Discrete Mathematical Structures: Theory and Applications 41
Special Circuits
10
Discrete Mathematical Structures: Theory and Applications 42
Special Circuits
Definition 10.4.9
An open trail in a graph is called an Euler trail if it contains all the edges and all the vertices.
Example 10.4.10
This is a connected graph. It has a vertex of odd degree. Thus, this graph has no Euler circuit, but the trail (v2, e7, v6, e5, v5, e4, v4, e3, v3, e2, v2, e1, v1, e6, v6) contains all the edges of G. Hence, this is an Euler trail.
10
Discrete Mathematical Structures: Theory and Applications 43
Special Circuits
10
Discrete Mathematical Structures: Theory and Applications 44
Special Circuits
This diagram in Figure 10.63 is a connected graph with 20 vertices. Each Vertex represents a famous city. It follows that the game is equivalent to finding a cycle in the graph in Figure 10.63 that contains each vertex exactly once except for the starting and ending vertices, which appear twice, making a Hamiltonian Cycle.
10
Discrete Mathematical Structures: Theory and Applications 45
Special Circuits
10
Discrete Mathematical Structures: Theory and Applications 46
Special Circuits
10
Discrete Mathematical Structures: Theory and Applications 47
Special Circuits
10
Discrete Mathematical Structures: Theory and Applications 48
Special Circuits During a certain soccer tournament
with 4 teams, each team has played against all the others exactly once and there were no ties. All the teams can be listed in order so that each has defeated the team next on the list.
Let the teams be denoted by v1, v2, v3, and v4 and let the matches correspond to the vertices and the arcs of a directed graph, respectively, in such a way that the initial and terminal vertices of an arc correspond to the winner and loser, respectively, of the corresponding match.
v2 → v1 → v3 → v4 is a Hamiltonian directed path.
10
Discrete Mathematical Structures: Theory and Applications 49
Isomorphism
10
Discrete Mathematical Structures: Theory and Applications 50
Isomorphism
Similarly, for other vertices, any two vertices vi and vj are end vertices of some edge ek in G1 if and only if f(vi) and f(vj) are end vertices of edge h(ek) in G2.
G1 is therefore isomorphic to G2
In Figure 10.77, v1 and v2 are the end vertices of edge e1 in G1 and f(v1) = u1 and f(v2) = u3 are end vertices of edge h(e1) = f2 in G2. Also, f(v3) = u4 and f(v1) = u1 are the end vertices of edge f4 = h(e2) in G2 and v3 and v1 are end vertices of edge e2 in G1.
10
Discrete Mathematical Structures: Theory and Applications 51
Isomorphism
10
Discrete Mathematical Structures: Theory and Applications 52
Isomorphism
10
Discrete Mathematical Structures: Theory and Applications 53
10
Discrete Mathematical Structures: Theory and Applications 54
10
Discrete Mathematical Structures: Theory and Applications 55
10
Discrete Mathematical Structures: Theory and Applications 56
10
Discrete Mathematical Structures: Theory and Applications 57
Graph Algorithms
Graphs can be used to show how different chemicals are related or to show airline routes. They can also be used to show the highway structure of a city, state, or country.
The edges connecting two vertices can be assigned a nonnegative real number, called the weight of the edge.
If the graph represents a highway structure, the weight can represent the distance between two places, or the travel time from one place to another.
Such graphs are called weighted graphs.
10
Discrete Mathematical Structures: Theory and Applications 58
Graph Algorithms
10
Discrete Mathematical Structures: Theory and Applications 59
Graph Algorithms
10
Discrete Mathematical Structures: Theory and Applications 60
Graph Algorithms
10
Discrete Mathematical Structures: Theory and Applications 61
Graph Algorithms
10
Discrete Mathematical Structures: Theory and Applications 62
10
Discrete Mathematical Structures: Theory and Applications 63
10
Discrete Mathematical Structures: Theory and Applications 64
10
Discrete Mathematical Structures: Theory and Applications 65
Graph Algorithms
10
Discrete Mathematical Structures: Theory and Applications 66
Graph Algorithms
10
Discrete Mathematical Structures: Theory and Applications 67
Graph Algorithms To guide the breadth-first topological ordering, use
a data structure called a queue. Formally, a queue is a data structure in which elements are added at one end, called the rear of the queue, and removed from the other end, called the front of the queue. Items are processed in the order they arrive.
When the immediate predecessor count of a vertex becomes 0, it is placed next in the queue. The vertex at the front of the queue is removed and placed in the topological order. It follows that when a vertex, say v, is placed in the queue, either all of its predecessors are already placed in the topological order or they are in the queue. Because vertex v is placed at the end of the queue before it is placed in the topological order, all of its predecessors are placed in the topological order.
10
Discrete Mathematical Structures: Theory and Applications 68
10
Discrete Mathematical Structures: Theory and Applications 69
Planar Graphs and Graph Coloring
10
Discrete Mathematical Structures: Theory and Applications 70
Planar Graphs and Graph Coloring
A graph is a planar graph if and only if it has a pictorial representation in a plane which is a plane graph. This pictorial representation of a planar graph G as a plane graph is called a planar representation of G.
Let G denote the plane graph in Figure 10.111. Graph G, in Figure 10.111, divides the plane into different regions, called the faces of G.
10
Discrete Mathematical Structures: Theory and Applications 71
Planar Graphs and Graph Coloring
10
Discrete Mathematical Structures: Theory and Applications 72
Planar Graphs and Graph Coloring
10
Discrete Mathematical Structures: Theory and Applications 73
Planar Graphs and Graph Coloring
10
Discrete Mathematical Structures: Theory and Applications 74
Planar Graphs and Graph Coloring
10
Discrete Mathematical Structures: Theory and Applications 75
Planar Graphs and Graph Coloring
10
Discrete Mathematical Structures: Theory and Applications 76
10
Discrete Mathematical Structures: Theory and Applications 77
10
Discrete Mathematical Structures: Theory and Applications 78
10
Discrete Mathematical Structures: Theory and Applications 79
Planar Graphs and Graph Coloring
10
Discrete Mathematical Structures: Theory and Applications 80
Planar Graphs and Graph Coloring
10
Discrete Mathematical Structures: Theory and Applications 81
10
Discrete Mathematical Structures: Theory and Applications 82
10
Discrete Mathematical Structures: Theory and Applications 83