You are on page 1of 39

Chapter 2

Paths and Cycles

Connectivity
Notations
Let G be a graph and v vertex of G. Then
d(v) : number of non-loop edges containing v
plus twice the number of loops containing v.
(G) : maximum degree of G.
(G) : minimum degree of G.
k-regular : (G) = (G) = k.
isolated vertex : degree=0.
Neighborhood : NG(v) , NG[v]
n(G) : order of G , is the number of vertices in
G.
e(G) : the number of edges in G.

Connectivity
Notations
Let G be a digraph. Then
d+(v) : the number of arcs of the form vw.
d-(v) : the number of arcs of the form wv.
Neighborhood : N+G (v) , N-G[v]

Connectivity
Walk
A walk in a graph G is a finite sequence of
edges of the form v0v1, v1v2, . . . , vm-1vm,
also denoted by
in which any two consecutive edges are
adjacent or identical.
We call v0 the initial vertex and vm the
final vertex of the walk, and speak of a
walk from v0 to vm. The number of edges
in a walk is called its length.

Connectivity
Trail, Path and Cycle
Trail: a trail is a walk with no repeated edge
Path : a path is a walk with no repeated
vertex.
Cycle : a path from v0 to v0

Connectivity
Connected graph
A graph G is connected if there is a
path between every pair of vertices.
A component of a graph : the maximal
connected subgraph. (nontrivial :
contains an edge)

Connectivity
Connected graph
A cut-edge (cut-vertex): an edge (a
vertex) whose deletion increases the
number of components.
Note that : cut-edge belongs to no
cycle !!!

Connectivity
Connected digraph
A digraph D is connected if the
underlying graph of D is a connected
graph.
A digraph D is strongly connected if,
for any two vertices v and w of D, there
is a directed path from v to w.
Every strongly connected digraph is
connected, but not all connected digraphs
are strongly connected;

Connectivity
Some results
Theorem. If v is a cut-vertex of a simple
graph G, then v is not a cut-vertex of the
complementary of G.
G-v : S , T
_
G-v : S, T

SS ST

ST TT

Connectivity
Some results
Theorem. A graph G is bipartite if and only
if every cycle of G has even length.
Idea :
v
X

odd

N(v)
Y

even

indep.

Connectivity
Some results
Recall
(Degree Sum Formula) If G is a graph
with vertex degree d1,,dn, then the
summation of all di = 2e(G).
The number of vertices of odd degree is
even.

Connectivity
Some results
Pigeonhole Principle : If a set consisting of
more than kn objects is partitioned into n
classes, then some class receives more
than k objects.
Theorem. Every simple graph with at least
two vertices has two vertices of equal
degree.
Theorem. If G is a simple graph of n

Connectivity
Some results
Theorem. Every 3-regular simple
connected graph has no cut-edge.
.

[26] for a wide range of practical problems, often with algorithms for their solution.
In this section we outline four types of problem that involve paths and cycles: the
sho test p th p oble , the c itic l p th p oble , the Chinese post n p oble and
the t elling s les n p oble . The first two of these can be solved by efficient
algorithms finite step-by-step procedures that quickly yield the solutions. The third
problem can also be solved by an efficient algorithm, but we consider only a special
case here. For the fourth problem, no efficient algorithms are known; we must therefore choose between algorithms that take a long time to implement and heuristic
algorithms that are quick to apply but give only an approximation to the solution.

Some Known Problems

Shortest path Problem

shortest path problem


If The
the
costs of this digraph correspond to
Suppose that we have a diagram of the form shown in Fig. 2.35, in which the letters
- refer toof
townsroad,
that are connected
by roads.
lengths
of these roads are
length
what
isIf the
the
length
ofas m
aarked, what is the length of a shortest path from to ? (We write a shortest path rather
than theshortestpath
path sincefrom
theremay beA
more
thanL?
onepath with this shortestlength.)
shortest
to

Figure 2.35

Note that the numbers in the diagram might also refer, not to the length of each
road, but to the time taken to travel along it, or to the cost of doing so. Thus, if

Some Known Problems


Shortest path Problem
There are several methods that we can use
to solve this problem.
The idea here is
to move across the map from left to
right,
labelling each vertex V with a number
l(V ) that indicates the shortest distance
from A to V.
Every time, we start with the smallest
vertex with I(V)

Eulerian Graphs and


Digraphs
Eulerian graph

2.2 Eulerian graphs and digraphs 41

Eulerian
Let graphs
G be

a connected graph.
A connected graphG is Eulerian if there exists a closed trail that includes every edge
such
G aistrailEulerian
there
exists
a closed
of G;
is an Eulerian if
trail.
Note that
this definition
requires you to
traverse each
edge(Eulerian
once and once only,
and tothat
finish atincludes
your starting point.
A nontrail
trail)
every
Eulerian graph G is semi-Eulerian if there exists a (non-closed) trail that includes
edge
of G.2.14, 2.15 and 2.16 show graphs that are Eulerian, semievery edge
of G. Figures
Eulerian
and non-Eulerian, respectively.
G
is semi-Eulerian if there exists a
trail that includes every edge of G.

Figure 2.14

Figure 2.15

Figure 2.16

Eulerian Graphs and


Digraphs
Eulerian graph
Lemma. If G is a graph in which the
degree of each vertex is at least 2, then G
contains a cycle.
Idea : start from a node and try to find a
new not visited node

Eulerian Graphs and


Digraphs
Eulerian graph
Theorem. A connected graph G is Eulerian
if and only if the degree of each vertex of G
is even.
Idea :
Compute the number of edge of a
eulerian trail
Use lemma to find a cycle. Then delete
edges of this cycle

Eulerian Graphs and


Digraphs
Eulerian graph
Corollary. A connected graph is Eulerian if
and only if its set of edges can be split up
into edge-disjoint cycles.
Idea : easy

Eulerian Graphs and


Digraphs
Eulerian graph
Corollary. A connected graph is semiEulerian if and only if it has exactly two
vertices of odd degree.
Idea : same proof as for the theorem

Eulerian Graphs and


Digraphs
Eulerian graph
Question.
Le G be an Eulerian graph. Propose an
algorithm that produces an Eulerian trail of
G.
Idea : use the idea of the proof of the
theorem

Eulerian Graphs and


Digraphs
Eulerian graph
Response: Fleurys algorithm (1883)
start at any vertex u and traverse the
edges in an arbitrary manner, subject only
to the following rules:
(i) erase the edges as they are traversed,
and if any isolated vertices result, erase
them too;
(ii) at each stage, use a bridge only if there
is no alternative.

Eulerian Graphs and


Digraphs
Eulerian digraph
A connected digraph D is Eulerian if
there exists a closed directed trail that
44 Paths and cycles
includes every arc of D; such a trail is an
Eulerian trail.

Figure 2.19

Note that the digraph must be strongly


connected for an Eulerian trail to exist

Note that the digraph must be strongly connected for an Eulerian trail to exist. Note
also that any Eulerian graph is orientable, since we simply follow any Eulerian trail,
directing the edges in the direction of the trail as we go.
Our first aim is to give a necessary and sufficient condition, analogous to the one

Eulerian Graphs and


Digraphs
Eulerian digraph
Theorem. A strongly connected digraph is
Eulerian if and only if, for each vertex v of
D, d+(v) = d-(v)
Idea : the same as in eulerian graph

Eulerian Graphs and


Digraphs
Eulerian digraph
Exercises. Which of the following graphs
are Eulerian or semi-Eulerian?
(i) the complete graph K4;
(ii) the complete bipartite graph K2,3;
(iii) the graph of the cube;
(v) the Petersen graph.

Eulerian Graphs and


Digraphs
Eulerian digraph
Exercises.
(i) For which values of n is Kn Eulerian?
(ii) Which complete bipartite graphs are
Eulerian?
(iII) For which values of n is the wheel Wn
Eulerian?

Some Known Problems


Knigsberg Bridges
Many important advances in graph
theory arose as a result of attempts to
solve particular problems Euler and the
bridges of Knigsberg
There is solution if only if there is at
most two lands (vertices) having an odd
degree ?

Some Known Problems


The Chinese Postman Problem
A postman wishes to deliver his letters,
covering the least possible total distance
and returning to his starting point. He must
obviously traverse each road in his route at
least once, but should avoid covering too
many roads more than once.
This problem is first discussed by the
Chinese mathematician Meigu Guan.

56 Paths and cycles

Some Known Problems

his starting point. He must obviously traverse each road in his route at least once, but
should avoid covering too many roads more than once.
This problem can be reformulated in terms of a weighted graph, where the graph
corresponds to the network of roads, and the weight of each edge is the length of the
corresponding road. In this reformulation, the requirement is to find a closed walk of
minimum total weight that includes each edge at least once. If the graph is Eulerian,
then any Eulerian trail is a closed walk of the required type; such an Eulerian trail can
be found by Fleurys algorithm (see Section 2.2). If the graph is not Eulerian, then
the problem is much harder, although an efficient algorithm for its solution is known
(see Gibbons [23]).
To illustrate the ideas involved, we look at a special case, in which exactly two
vertices have odd degree (see Fig. 2.39).

The Chinese Postman Problem

Graph Reformulation : the graph


corresponds to the network of roads, and
the weight of each edge is the length of
the corresponding road

Figure 2.39

Since vertices and E are the only vertices of odd degree, we can find a semiEulerian trail from to E covering each edge exactly once. In order to return to the
starting point, covering the least possible distance, we now find the shortest path from
E to using the algorithm described above. The solution of the Chinese postman

find a closed walk of minimum total weight


that includes each edge at least once

his starting point. He must obviously traverse each road in his route at least once, but
should avoid covering too many roads more than once.
This problem can be reformulated in terms of a weighted graph, where the graph
corresponds to the network of roads, and the weight of each edge is the length of the
corresponding road. In this reformulation, the requirement is to find a closed walk of
minimum total weight that includes each edge at least once. If the graph is Eulerian,
then any Eulerian trail is a closed walk of the required type; such an Eulerian trail can
be found by Fleurys algorithm (see Section 2.2). If the graph is not Eulerian, then
the problem is much harder, although an efficient algorithm for its solution is known
(see Gibbons [23]).
To illustrate the ideas involved, we look at a special case, in which exactly two
vertices have odd degree (see Fig. 2.39).

Some Known Problems

The Chinese Postman Problem

Eulerian graph: any eulerian trail is a


solution (see theorem on eulerian graph)

Figure 2.39

Semi-eulerian graph : start from an odd


Since vertices and E are the only vertices of odd degree, we can find a seminode
totoan
odd
and
compute
Eulerian
trailB
from
E covering
eachnode
edge exactlyEonce.
In order
to return to the the
starting point, covering the least possible distance, we now find the shortest path from
from
Eabove.
to The
B solution of the Chinese postman
Eshort
to usingpath
the algorithm
described
problem is then obtained by combining this shortest path

Some Known Problems


The Chinese Postman Problem
Theorem. Finding an optimal solution in a
graph is POLYNOMIAL.
Idea:
Short path is polynomial
Minimal matching is polynomial
Eurelian trail is polynomial is eurelian
graph

Some Known Problems


The Chinese Postman Problem
Edmonds Algorithm
Let S be the set of odd vertices in G
Compute the shortest path between each
pair of vertices a,b in S
Using the shortest path found in previous
ste , form a graph H
Find the minimum matching of H
For each edge (x,y) in M*, duplicate the
edges along the shortest path between x
and y in G

Some Known Problems


The Chinese Postman Problem
Theorem (General case). Finding an
optimal solution in a graph with both
directed and undirected edges is NPcomplete.

2.3 Hamiltonian graphs and digraphs 47

Hamiltonian Graphs and


Digraphs
use it to obtain a circular arrangement of nine 1s, nine 2s and nine 3s in which each of
the 27 possible triples (111, 233, etc.) occurs exactly once. (Problems of this kind arise
in communication theory.)

2.25

(i) Find an Eulerian trail in the infinite square lattice .


(ii) Verify that satisfies the conditions of Theorem 2.14.

2.26

Repeat Exercise 2.25 for the infinite triangular lattice.

Hamiltonian graph

Hamiltonian graphsgraph
and digraphs
A2.3connected
G is hamiltonian if
we discussedexists
whether therea
exists
a closed trail that includes
GIn the
isprevious
K1 section
or there
cycle
every edge of a given connected graph G. A similar problem is to determine whether
there exists a closed trail passing
exactly once
each vertexexactly
of G: such a trail once
(Hamiltonian
cycle
) through
passing
must be a cycle, except when G is the graph . Such a cycle is a Hamiltonian cycle
through
each
vertex
of G.graph. A non-Hamiltonian
and a graph with a
Hamiltonian
cycle is a Hamiltonian
graph is semi-Hamiltonian if there exists a path through every vertex. Figures 2.24,
and 2.26 show graphs that are Hamiltonian,
A2.25non-Hamiltonian
graphsemi-Hamiltonian
is semi-and nonHamiltonian, respectively.
Hamiltonian if there exists a path
through every vertex.
1

Figure 2.24

Figure 2.25

Figure 2.26

Hamiltonian Graphs and


Digraphs
Hamiltonian graph
Theorem (Ore, 1960).
If G is a simple graph with n ( 3) vertices,
and if
d(v) + d(w) n for each pair of nonadjacent vertices v and w, then G is
Hamiltonian.

Hamiltonian Graphs and


Digraphs
Hamiltonian digraph
A digraph D is hamiltonian if there
exists a directed cycle (Hamiltonian
cycle) passing exactly once through each
vertex of D.
We knows few results on hamiltonian
digraph

Some Known Problems


The travelling salesman problem
A travelling salesman wishes to visit
several given cities and return to his
starting point, covering the least possible
total distance.

Some Known Problems


The travelling salesman problem
A travelling salesman problem : find the
minimal Hamiltonian cycle
One possible algorithm: calculate the
total distance for all possible Hamiltonian
cycles.
This is far too time consuming for more
than about five cities. For example, if
there are 20 cities, then the number of
possible cycles is 1/2(19!).

Some Known Problems


The travelling salesman problem
Travelling Salesman Problem: find a
Hamiltonian cycle of least possible total
weight in a given weighted complete
graph (finding Hamiltonian cycle).
Theorem (General case). Finding an
optimal solution in a graph or a digraph is
NP-complete.

You might also like