You are on page 1of 7

Notes on Graph Theory

Travelling Problems
Review of definitions and basic theorems:
1. A walk in a graph G is a finite sequence of edges
1 2
( , , , )
n
e e e K
in which any two
consecutive edges are adjacent of identical.
2. A walk in which all edges are distinct is called a trail.
3. f the vertices of a trail are distinct (e!cept the initial verte! and final verte! possi"ly
coincide), then the trail is called a path.
#. $e say a walk%trail%path is closed if the initial verte! is also the finial verte!.
&. A closed path with at least one edge is called a cycle.
'. A graph is connected if and only if there is a path "etween each pair of vertices.
(. f G is a si)ple graph with n vertices, m edges, and k co)ponents, then
1
2
n k
n k m
+



.
As a corollary, any si)ple graph with n vertices and )ore than
1
2
n


edges
)ust "e connected.
Eulerian graphs
A connected graph G is said to "e Eulerian if there e!ists a closed trail containing every edge
of G. A non*+ulerian graph G is said to "e semi-Eulerian if there e!ists a trail containing
every edge of G .
,he na)e -+ulerian. arises fro) the fact that +uler was the first person to solve the
fa)ous /0nigs"erg "ridges pro"le). ,he pro"le) asks whether you can cross each of
the following seven "ridges e!actly once and return to your starting point.
1age 1 of (
Lemma.
f each verte! of a graph G is at least 2, then G contains a cycle.
Proof. ,rivial2
Theorem . !Euler" #$%&
A connected graph G is +ulerian if and only if the degree of each verte! of G is even.
Proof.
f G is +ulerian and P is an +ulerian trail, then there is a contri"ution of 2 towards the degree
whenever P passes through a verte!. t follows that each verte! has even degree.
3n the other hand, suppose that each verte! of G has even degree and we need to construct
an +ulerian trail.
$e apply induction on the nu)"er of edges of G. 4learly when G contains only 1 edge the
state)ent is true.
Assu)e that the state)ent is true for all graphs having fewer edges than G. 5ince G is
connected, each verte! has degree at least 2. 6y the le))a, there is a cycle C in G.
7e)oving this cycle will produce a new graph H, which is possi"ly disconnected or even a
null graph. 6y the induction hypothesis, each co)ponent of H has an +ulerian trail. 8ote that
each co)ponent of H has at least one verte! in co))on with C (otherwise, G should "e
disconnected).
8ow, we o"tain the required +ulerian trail (of G) "y following the edges of C, if a non*
isolated verte! of H is reached, tracing the +ulerian trail (of that +ulerian co)ponent of H),
and then continuing along the edges of C, and so on. ,his process stops when we return to
the starting verte!.
'orollaries.
(1) A connected graph is +ulerian if and only if its set of edges is union of disjoint cycles.
(2) A connected graph is se)i*+ulerian if and only if it has e!actly two vertices of odd
degree. (,he -only if. part is o"vious. 9or the -if. part, si)ply join that two -odd
vertices. "y an edge, resulting in a +ulerian graph "y ,heore) 1.)
1age 2 of (
C
An Eulerian component of H
An Eulerian component of H
Theorem (. !)leury*s algorithm&
:et G "e an +ulerian graph. ,hen the following construction is always possi"le, and
produces an +ulerian trail of G.
5tart at any verte! u and traverse the edges ar"itrarily, e!cept su"ject to 2 rules;
(a) erase the edges as they are traversed, and the isolated vertices resulted (if any)<
(") use a "ridge only if there is no alternative.
6efore proving this algorith) works, we need a le))a.
Lemma.
+ulerian graph contains no "ridge. +ach odd verte! of a se)i*+ulerian graph is incident with
at )ost 1 "ridge. (7easons; the first state)ent is an application of hand*shaking le))a,
while the second one is a corollary of the first.)
Proof of Theorem (.
5uppose at so)e stage we have just reached a verte!
v u
and the resulting graph is still
connected. $e will show that the ne!t step can "e carried out and produce also a connected
graph.
4ase 1;
f v incident with an edge which is not "ridge, then there is no trou"le.
4ase 2;
All edges incident with v are "ridge. n case there is only 1 "ridge incident with v ("y the
le))a), traverse through this "ridge, erase this "ridge and the verte! v ("ecause v is now
isolated). ,he resulting graph is still connected.
5ince the graph is finite, we )ust finally return to u (and the re)aining graph, if e!ists, is
still a connected graph). f there is nothing re)ains, that )eans an +ulerian trail is found.
3therwise, the re)aining graph is still +ulerian and the algorith) can go on until we have
traversed all the edges.
+amiltonian graphs
A connected graph G is said to "e Hamiltonian if there e!ists a cycle passing through each
verte! of G. ,his cycle is called Hamiltonian cycle of G. A non*=a)iltonian graph G is
said to "e se)i*=a)iltonian if there e!ists a path passing through each verte! of G . ,his
path is called Hamiltonian path of G .
+!a)ples of =a)iltonian graphs;
Theorem $. !,re" -%.&
1age 3 of (
f G is a si)ple graph with 3 n vertices such that
deg( ) deg( ) u v n +
for each pair of non*adjacent vertices u, v, then G is =a)iltonian.
Proof.
5uppose G is not =a)iltonian. $e )ay assu)e G is a -)a!i)al non*=a)iltonian graph. (in
the sense that adding e!tra edge will give a =a)iltonian graph).
4onsider the longest path
1 2 n
v v v L
in the graph (note that this path )ust pass
through every verte!). 4learly,
1
,
n
v v
is not adjacent.
4ase 1;
$hen 3 n = , we have
1 3
deg( ) deg( ) 3 v v +
, so
1 3
, v v
is adjacent. ,his is a contradiction.
4ase 2;
$hen 3 n > , there are n 3 ordered pairs
1
( , )
i i
v v
+
where
2, , 2 i n = K
. :et A "e the set of
the pairs such that
1 1
,
i
v v
+
are adjacent and B "e the set of those such that
,
i n
v v
are adjacent.
5ince
1
deg( ) deg( )
n
v v n +
, we have
2 A B n +
. 6ut there is only n 3 pairs, one of the
pair, says
1
( , )
j j
v v
+
with
2 2 j n
, )ust "elong to "oth A and B. ,herefore,
1
v is adjacent
to
1 j
v
+
and
j
v
is adjacent to
n
v
, as shown in the following figure.
8ow,
1 2 1 1 1 j n n j
v v v v v v v
+
L L
is a =a)iltonian cycle.
n "oth cases, we lead to a contradiction "y constructing a =a)iltonian cycle. $e conclude
that G is =a)iltonian.
'orollary. !/irac" -0(&
f G is a si)ple graph with 3 n vertices such that deg( )
2
n
v for each verte! v, then G is
=a)iltonian.
1age # of (
v
1
v
2
v
j
v
j+1
v
n-1
v
n
The shortest path problem
A connected graph in which a non*negative real nu)"eris assigned to each edge is called
weighted graph, the nu)"er assigned to the edge e is the weight of e, denoted "y
( ) w e
.
Problem.
9ind a path "etween two vertices in a weighted (si)ple) graph with )ini)u) total weight.
,here is an efficient algorith) to solve this kind of pro"le)s. $e will go through this "y an
e!a)ple;
,o find the shortest path fro) A to B, we use the following )ethod;
!& 1ssign to each verte2 ad3acent to A" it*s distance from A.
2
5
1
A B
!(& 1mong this numbers" mar4 the smallest number !if it is not uni5ue" 3ust choose
one of them& by any symbol !here we will use a 678&. 9n this algorithm" a mar4ed
number means it is the shortest distance from A to that verte2.
2
5
1*
A B
Then" repeat the following ( steps:
!a& Let
, ( ) u d u
be the verte2 and number mar4ed in the previous step. )or each
unmar4ed verte2 v A ad3acent to u" calculate the sum
( ) ( ) d u w uv +
. 9f this sum
is less than the value at v" or we have not assigned any value to v" then the value at
v is updated by this sum.
1ny unmar4ed number in this stage means the shortest distance from A to that
verte2 passing through only mar4ed verte2.
1age & of (
2
3
4
1 5
3
6
1
7
1
5 4
1
A B
!b& 1mong all unmar4ed numbers" mar4 the smallest one !again" if it is not uni5ue
then choose any one of them&.
n our e!a)ple, repeat (a) and (") we will get;
2*
5
1*
A B
8
2*
5
5*
1*
A B
8
2*
5*
5*
1*
A
11
B
6
9
2*
5*
5*
1*
A
8
B
6*
9
2*
5*
5*
1*
A
8
B
6*
7*
,he shortest distance fro) A to B is ( and the shortest path can "e found "y tracing "ack the
steps.
1age ' of (
The 'hinese postman problem
,his pro"le) is discussed "y 4hinese )athe)atican >ei*/u /wan, asking the )ost
efficient walk (with least repeat) for a post)an to traverse each road in his route.
Problem.
n a weighted (si)ple) graph, find a closed walk to traverse each edge at least once with
)ini)u) total weight.
8ote that if the graph is +ulerian, then the required walk is si)ply the +ulerian trail.
An o"vious inequality a"out the )ini)u) total weight d is
( ) 2 ( ) w e d w e

,
"ecause dou"le each edge will give an +ulerian graph.
f the graph is se)i*+ulerian, we can )ake it "eco)e +ulerian "y dou"le each edge in the
shortest path joining two odd vertices. ,he +ulerian trail will "e our required ()ost efficient)
walk.
n general, the )ost efficient walk can "e o"tained "y dou"le so)e path(s), each path "eing
the shortest path joining two odd vertices (re)ind that the nu)"er of odd vertices in
any graph )ust "e even, "y hand*shaking le))a). ,he resulting graph is +ulerian
and the required walk is then the +ulerian trail.
f the graph has 2k (where 1 k ) odd vertices then there are (2k 1)22 possi"le ways to pair
up the odd vertices. $e need to try all these possi"le ways2
The travelling salesman problem
Problem.
n a weighted (si)ple) graph, find a =a)iltonian cycle of least total weight. 6y adding e!tra
edges with infinite weight if necessary, we )ay assu)e the graph is co)plete.
7
4
3 4
5
3
2
6
3
5
C D
B
A
E
?p to now, no efficient algorith)s are known. 5o)e -quick. algorith)s can only find an
appro!i)ated solution.
1age ( of (

You might also like