GRAPH THEORY
Please note that the material on this website is not intended to be exhaustive.
This is intended as a summary and supplementary material to the required textbook.
- Graph
-
G = ( V, E ) ( or G = < N, E > ) is a set of finite and nonempty
vertices V = { v0, v1,
¼, vk} ( or nodes ) and a set of
finite and nonempty edges E = { e1,
e2, ¼, ej} where an edge connects two vertices.

- Path
- is a sequence of vertices that traces the "travel" from an initial vertex to a terminal vertex.
Edges can either be undirected or directed.
- Undirected edge
-
e that is associated with vertices vi and vj is denoted as e = (
vi, vj) or e = ( vj, vi).
- Directed Edge
-
is a unique ordered pair of vertices e = ( vi, vj) which takes on the form of an
arrow originating at the initial vertex of the
edge, vi, and terminates at the
terminal vertex of the edge, vj.
- Incident
-
A directed or undirected edge e that is associated with vertices vi and
vj is said to be incident on vi and vj.
Vertices vi and vj are then said to be incident on e and are
adjacent vertices.
A vertex v that is not incident to an edge is said to be an
isolated vertex.
-
Directed Graph or Digraph
-
is a graph whose edges are all directed and where the set of ordered pairs of vertices are called
arcs.
- Multigraph
-
Two vertices of a graph that are connected by more than one edge are said to contain parallel edges or
multiple edges.
A graph with multiple edges is called a multigraph.
| Example: |
Is Figure 1 a multigraph? Why or why not? Is Figure 2 a multigraph? Why or why not?
|
- Loop
- is an edge connecting a vertex to itself or is incident on a single vertex.
- Pseudograph
- is a graph with loops.
| Example: |
Is Figure 1 a psuedograph? Why or why not?
Is Figure 2 a psuedograph? Why or why not?
|
- Simple Graph
- is a graph with no parallel or multiple edges nor loops.
| Example: |
Is Figure 1 a simple graph? Why or why not?
Is Figure 2 a simple graph? Why or why not?
|
- Complete Graph
-
on n vertices is the simple graph with n vertices in which there is an edge between every pair of
distinct vertices and is denoted by Kn.
| Example: |
Is Figure 1 a complete graph? Why or why not?
Is Figure 2 a complete graph? Why or why not?
|
- Bipartite Graph
-
G = { V, E } is one where there are two subsets V1 and V2 of V
such that V1
V2 =
Æ, V1
V2 = V, and each edge in E is incident to one vertex in V1 and one vertex
in V2.

- Complete Bipartite Graph
-
on m and n vertices is the simple graph whose vertex set is partitioned into sets
| V1 | = m vertices and | V2 | = n vertices in which there is an edge between
each pair of vertices v1 ÎV1 and v2
ÎV2 and it is denoted by
Km,n.
- Weighted Graph
-
is a graph with labelled edges.
If edge e is labelled k, then it is said that the weight of e is k.

- Length
- of a path in a weighted graph is the sum of the weights of the edges in the path.
| Example: |
WEIGHTED EDGES |
v1,v2 = 15
v1,v3 = 23
v1,v4 = 21
v1,v5 = 16
v1,v6 = 5
|
|
v2,v1 = 15
v2,v3 = 14
v2,v4 = 24
v2,v5 = 22
v2,v6 = 3
|
|
v3,v1 = 23
v3,v2 = 14
v3,v4 = 12
v3,v5 = 25
v3,v6 = 7
|
|
v4,v1 = 21
v4,v2 = 24
v4,v3 = 12
v4,v5 = 17
v4,v6 = 9
|
|
v5,v1 = 16
v5,v2 = 22
v5,v3 = 25
v5,v4 = 17
v5,v6 = 2
|
|
v6,v1 = 5
v6,v2 = 3
v6,v3 = 7
v6,v4 = 9
v6,v5 = 2
|
| PATH |
LENGTH |
v1, v2, v3, v4, v5, v6 :
15 + 14 + 12 + 17 + 2 = 60
v1, v2, v3, v4, v6, v5 :
15 + 14 + 12 + 9 + 2 = 52
v1, v2, v3, v5, v4, v6 :
15 + 14 + 25 + 17 + 9 = 80
v1, v2, v3, v5, v6, v4 :
15 + 14 + 25 + 2 + 9 = 65
v1, v2, v3, v6, v4, v5 :
15 + 14 + 7 + 9 + 17 = 62
v1, v2, v3, v6, v5, v4 :
15 + 14 + 7 + 2 + 17 = 55
v1, v2, v4, v3, v5, v6 :
15 + 24 + 12 + 25 + 2 = 78
v1, v2, v4, v3, v6, v5 :
15 + 24 + 12 + 7 + 2 = 60
v1, v2, v4, v5, v3, v6 :
15 + 24 + 17 + 25 + 7 = 88
v1, v2, v4, v5, v6, v3 :
15 + 24 + 17 + 2 + 7 = 65
v1, v2, v4, v6, v3, v5 :
15 + 24 + 9 + 7 + 25 = 80
v1, v2, v4, v6, v5, v3 :
15 + 24 + 9 + 2 + 25 = 75
v1, v2, v5, v3, v4, v6 :
15 + 22 + 25 + 12 + 9 = 83
v1, v2, v5, v3, v6, v4 :
15 + 22 + 25 + 7 + 9 = 78
v1, v2, v5, v4, v3, v6 :
15 + 22 + 17 + 12 + 7 = 73
v1, v2, v5, v4, v6, v3 :
15 + 22 + 17 + 9 + 7 = 70
v1, v2, v5, v6, v3, v4 :
15 + 22 + 2 + 7 + 12 = 58
v1, v2, v5, v6, v4, v3 :
15 + 22 + 2 + 9 + 12 = 60
¼etc. ¼
|
-
Hypercube or ncube
-
is an important model of computation which describes parallel processing, i.e where a computer system is able to
have more than 2n processors instead of just one.
The construction of the ncube is as follows:
-
The 1cube consists of
2 processors labeled 0 and 1.




-
Suppose H1 is an (n1)cubes.
Make a duplicate copy of H1, say call it H2.
To form an ncube, connect with an edge all corresponding
vertices in H1 and H2, i.e. vertices with the same labels.
Then relabel the vertices in H1 to 0L and the vertices in H2 to
1L.
Since the world is a three dimensional world, it is not readily possible to illustrate ncube, where n >
4.
- Connected Graph
-
G is one where there is a path from any vertex v of G to any other vertex w of
G, otherwise G is disconnected.
- Bridge
- is an edge e of graph G which renders G disconnected when e is removed.
- Biconnected Graph
- G is one where G is connected and does not have a bridge.
- kedge Connected
- graph G is one where G is still connected when any k edges are removed from G.
- kvertex Connected
-
graph G is one where G is still connected when any k vertices are removed from G.
A finite graph G is always a finite union of maximal connected graphs which
are called connected components of G.
- Strongly Connected
-
digraph G is one where there is a directed path from any vertex of G to any other vertex of G.
- Subgraph
-
of graph G = ( V, E ) is a graph G' = ( V', E' ) where V' Í V
and E' Í E and for every edge e' Î
E', if e' is incident on v' and w', then v', w' Î
V'.
- Walk
-
on a graph G is an alternating sequence of vertices and edges v0, e1,
v1, e2, ¼, en, vn beginning and
ending with a vertex such that each edge is immediately preceded and followed by the two vertices which lie on it.
- Trail
- is a walk whose edges are all distinct.
- Simple Path
- is a walk whose vertices are all distinct.
- Closed Walk
- is one where v0 = vn.
- Cycle or Circuit
- is a closed path where n ³ 3.
- Simple Cycle
- is a cycle whose vertices are distinct except for the beginning vertex and the ending vertex.
| Example: |
Consider the following garph |
 |
Consider the walk
v1 e5 v5 e4 v4 e6 v1 e8
v3 e2 v2 e11 v3 e10 v5
e7 v2 e1 v1
Is the walk above a trail? If not, can you modify it to create a trail?
Is the walk above a path? If not, can you modify it to create a path?
Is the walk above a closed walk? If not, can you modify it to create a closed walk?
Is the walk above a cycle? If not, can you modify it to create a cycle?
|
- Directed Cycle
- in digraph G is a closed directed path.
- Directed Cyclic Graph
- G is a graph that has no directed cycles.
- Euler cycle
- is a cycle in a graph G that includes all the edges and vertices of G.
- Degree
- of a vertex v is the number of edges incident on v and is denoted by
d(v).
- THEOREM:
- If a graph G has an Euler cycle, then G is connected and every vertex has even degree.
- THEOREM:
- If G is a connected graph and every vertex has even degree, then G has an Euler cycle.
- THEOREM:
-
If G is a graph with m edges and vertices { v1, v2,
¼, vn}, then
Sd(vi) = 2m
In particular, the sum of the degrees of all the vertices in a graph is even.
- CORROLARY:
- In any graph, there are an even number of vertices of odd degree.
- THEOREM:
-
-
A graph has a path with no repeated edges from v to w ( v ¹w )
containing all the edges and vertices if and only if it is connected and v and w are the only
vertices having odd degree.
- THEOREM:
-
If a graph G contains a cycle from v to v, then G contains a simple cycle from v
to v.
- Hamiltonian Cycle
-
is a cycle in a graph G that contains each vertex in G exactly once except for the starting and
ending vertex that appears twice.
This was named in honor of Sir William Rowan Hamilton.

- Dodecahedron
-
In other words, if each vertex in a dodecahedron were to represent a city, the problem consists of visiting
all the cities passing through each city once and only once except for the start and the end.

- Traveling Salesman Problem
-
A related problem is the traveling salesman problem, i.e. given a weighted graph G, find a
minimumlength Hamiltonian cycle in G.
This can be likened to the cities and the edge weights as distances.
Hence, the traveling salesman problem consists of finding a shortest route in which a salesman can visit each city
once and only one time, starting and ending at the same city.
- Ring Model
-
Consider a ring model for parallel computation where the vertices represent processors and an edge betweeen
processors p and q indicates direct communication between the two processors.
Observe that the graph of the model contains a simple cycle.

The ncube is another model for parallel computation offering greater connectivity among its
processors.
Observe that for an ncube to contain a Hamiltonian cycle, it must have n
³ 2 since a 1cube contains no cycles.
Recall that the vertices of the ncube may be labelled 0, 1, ¼,
2n1 such that an edge connects two vertices if and only if the binary representation of their
labels differs in exactly on bit.
Furthermore, the ncube has a Hamiltonian cycle if there is a sequence s1, s2,
¼, s2n called Gray code where each
si is a string of n bits, satisfying:
- Every nbit string appears somewhere in the sequence.
-
si and si+1 differ in exactly one bit, i = 1, 2,
¼, 2n1.
- s2n and s1 differ in exactly one bit.
When n ³ 2, a Gray Code
s1, s2, ¼, s2n
corresponds to the Hamiltonian cycle
s1, s2, ¼, s2n, s1
- THEOREM:
-
Let G1 denote the sequence 0, 1.
Define Gn in terms of Gn1 by the following rules:
-
Let GRn1 denote the sequence Gn1 written in reverse.
-
Let G'n1 denote the sequence obtained by prefixing each member of
Gn1 with 0.
-
Let G"n1 denote the sequence obatined by prefixing each member of
GRn1 with 1.
-
Let Gn be the sequence consisting of G'n1 followed by
G"n1.
Then Gn is a Gray code for every positive integer n.
| Construction of Gray Code |
|
|
| GR1 |
: |
1 |
0 |
| G'1 |
: |
00 |
01 |
| G"1 |
: |
11 |
10 |
| G2 |
: |
00 |
01 |
11 |
10 |
|
| GR2 |
: |
10 |
11 |
01 |
00 |
| G'2 |
: |
000 |
001 |
011 |
010 |
| G"2 |
: |
110 |
111 |
101 |
100 |
| G3 |
: |
000 |
001 |
011 |
010 |
110 |
111 |
101 |
100 |
|
| GR3 |
: |
100 |
101 |
111 |
110 |
010 |
011 |
001 |
000 |
| G'3 |
: |
0000 |
0001 |
0011 |
0010 |
0110 |
0111 |
0101 |
0100 |
| G"3 |
: |
1100 |
1101 |
1111 |
1110 |
1010 |
1011 |
1001 |
1000 |
| G4 |
: |
0000 |
0001 |
0011 |
0010 |
0110 |
0111 |
0101 |
0100 |
1100 |
1101 |
1111 |
1110 |
1010 |
1011 |
1001 |
1000 |
|
| Determine G5 |
- Knight's Tour
-
Another related problem is the Knight's
Tour where a knight chess piece traverses each square in a chess board once and only once.
A graph of legal moves for a knight piece in an n x n chess board is said to be a
GKn.
Then there is a knight's tour on the n x n chess board if and only if GKn has a
Hamiltonian cycle.
In a connected weighted graph G, a common problem is finding a shortest path.
- Dijkstra's ShortestPath Algorithm
-
This algorithm finds the length of a shortest path from vertex a to vertex z in a connected weighted
graph.
Let w(i, j) > 0 denote the weight of edge (i, j) and let L(x) denote the label of vertex
x.
At termination, L(z) is the length of a shortest path from a to z.
Let T denote the set of vertices having temporary labels.
Let circled vertex denote vertices having permanent label.
| Input: |
A connected weighted graph in which all weights are positive
Vertices a to z
|
| Output: |
L(z), the length of a shortest path from a to z. |
| Algorithm: |
procedure dijkstra (w, a, z, L)
L(a) := 0
for all vertices x ¹a do
L(x) :=
T := set of all vertices
// T is the set of vertices whose shortest distance from a has not been found
while z ÎT do
begin
choose v ÎT with minimum L(v)
T := T {v}
for each x ÎT adjacent to v do
L(v) := min {L(x), L(v) + w(v, x)}
end
end
|
- THEOREM:
-
Dijkstra's shortestpath algorithm correctly finds the length of a shortest path from a to z.
ASSIGNMENT
© 2000-07-07 cpsm; last update
2008-10-15 20:09