Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
4 views

DirectFileTopicDownload 1

Uploaded by

Tharun Sv
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

DirectFileTopicDownload 1

Uploaded by

Tharun Sv
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 64

Graph Theory

September 30, 2020


oeABA@__s-sTg

Graph Theory September 30, 2020


_-@ffIA← 1 / 63
-8-8-8-00
Outline

1 Introduction
2 Trees
3 Algorithm
4 References

Graph Theory September 30, 2020


toasted 2 / 63
taff
Introduction

Graph theory was originated from the Konigsberg Bridge Problem, where
two islands linked to each other and to the banks of the Pregel River by
seven bridges. The problem was to begin at any of the four land areas, walk
across each bridge exactly once and return to the initial point. This problem
was solved in 1736 by Euler. In 1847, Kirchhoff developed the theory of trees
to solve the system of linear equations which give the current in each branch
and around each circuit of an electric network. In 1857, Hamilton presented
that Hamilton s game. The game’s object is finding a Hamiltonian cycle
along the edges of a dodecahedron such that every vertex is visited only
once and the end vertex is same as the initial vertex.

Graph Theory September 30, 2020


-80--0--0-88 3 / 63
In 1936, Konig showed that, a graph is bipartite if and only if it has no
odd cycle. Thus, Graph theory is becoming increasingly significant as it
is applied to other areas of mathematics, science and technology. Graphs
are useful for representing networks and maps of roads, railways, airline
routes, pipe systems, telephone lines, electrical connections, prerequisites
amongst courses, dependencies amongst tasks in a manufacturing system,
a computer that provides client stations with access to files and printers
as shared resources to a computer network, the structural and biological
information derived from protein structures. There are a large number of
important results and structures that are computed from graphs.

Graph Theory September 30, 2020 _-z-


-@_g--gA 4 / 63
Definition
A graph G consists of a finite nonempty set V = V (G) of p points(vertices)
together with a prescribed set X of q unordered pairs of distinct points of
V . Each pair x = {u, v } of points in X is a line (edge) of G, and x is said
to join u and v . We write x = uv and say that u and v are adjacent points,
denoted u adj v or u ≥ v ; point u and line x are incident with each other,
as are v and x . If two distinct lines x and y are incident with a common
point, then they are adjacent lines. A graph with p points and q lines is
called a (p, q) graph. The (1, 0) graph is trivial.

Graph Theory September 30, 2020 fatso


-f-@eT_Tfg_ 5 / 63
u w t

v r s

Figure: G: A Graph to illustrate adjacency

Graph Theory September 30, 2020


-0--0--4 6 / 63
Goes
The ends of an edge are said to be incident with the vertex, and vice versa.
Two vertices which are incident with a common edge are adjacent, as are
two edges which are incident with a common vertex. An edge with identical
ends is called a loop and two edges with same end vertices are called parallel
edges.
A graph is finite if both its vertex set and edge set are finite.

Graph Theory September 30, 2020 eggers


-20--8--3 7 / 63
A graph is simple if it has no loops or parallel edges. A graph is finite if
both its vertex set and edge set are finite. A graph is simple if it has no
loops or parallel edges.
v1
e
e 1
6
v2
e
v5 4 e5
e
2
e e
7 8
v3

v4 e
3

Figure: A graph G with loops and multiple edges

Graph Theory September 30, 2020 Baze


__--_-f-- 8 / 63
Much of graph theory is concerned with the study of simple graphs. In
general, the symbol G is used for a graph, the number of elements in V (G)
is called order and the number of elements in E (G) is called the size of the
graph G. Note that, the definition of graph permits no loop, that is, no line
joining a point to itself. In a multigraph, no loops are allowed but more
than one line can join two points; these are called multiple lines. If both
loops and multiple lines are permitted, we have a pseudograph. Figure 2
is an an example for pseudograph.

Graph Theory September 30, 2020 Bff


_--_o@GB-- 9 / 63
A directed graph or digraph D consists of a finite nonempty set V of
points together with a prescribed collection X of ordered pairs of distinct
points. The elements of X are directed lines or arcs. By definition, a digraph
has no loops or multiple arcs.

Figure: A directed graph

A labelled graph is a graph in which every vertex and every edge is labeled.
most of the times, a graph means a labelled graph.

Graph Theory September 30, 2020


o@n-o_AgI 10 / 63
BAG
Two graphs G and H are isomorphic (written G ≥ = H or sometimes G = H)
if there exists a one-to-one correspondence between their point sets which
preserves adjacency.
An invariant of a graph G is a number associated with G which has the
same value for any graph isomorphic to G. Thus, the numbers p and q are
certainly invariants.

Figure: Isomorphic Graphs

Graph Theory September 30, 2020 FEE


-2062ns 11 / 63
A graph H is called a subgraph of a graph G if V (H) ™ V (G) and E (H) ™
E (G). A subgraph H of G is called a spanning subgraph if V (H) = V (G).
Let S be a subset of the vertex set V (G) of G. Then, the subgraph induced
by S, denoted by ÈSÍ is the maximal subgraph of G with S as the vertex set.
Thus, two points of S are adjacent in ÈSÍ if and only if they are adjacent in
G.

Figure: Graph of G and H1 subgraph of G

Graph Theory September 30, 2020


-0--3--0-3 12 / 63
v3 v4

v1 v2 v5
v6

v7 v
8
H3

Figure: H2 induced subgraph of G and H3 Spanning subgraph of G

Graph Theory September 30, 2020 -3g


-0--0-0 13 / 63
The removal of a point vi from a graph G results in that subgraph G ≠ vi of
G consisting of all points of G except vi and all lines not incident with vi .
Thus, G ≠ vi is the maximal subgraph of G not containing vi . On the other
hand, the removal of a line xj from G yields the spanning subgraph G ≠ xj
containing all lines of G except xj . Thus, G ≠ xj is the maximal subgraph
of G not containing xj . The removal of a set of points or lines from G is
defined by the removal of single elements in succession. On the other hand,
if vi and vj are not adjacent in G, the addition of line vi vj results in the
smallest supergraph of G containing the line vi vj .

Graph Theory September 30, 2020


tiff 14 / 63
_G8g_
A walk in G is a finite non-null sequence W = v0 e1 v1 e2 v2 e3 . . . ek vk whose
turns are alternately vertices and edges such that, for 1 Æ i Æ k, the ends of
ei are vi≠1 and vi . We say that W is a walk from v0 to vk or a (v0 , vk )≠ walk.
The vertices v0 and vk are called the origin and terminus of W respectively.
Other vertices in a walk are called internal vertices. The integer k, which is
the number of edges in W , is the length of W . In a simple graph, a walk
v0 e1 v1 e2 . . . ek vk is determined by the sequence v0 v1 . . . vk of vertices. If
the edges e1 , e2 , . . . , ek of a walk W are distinct, then W is called a trail;
in addition, if the vertices v0 v1 . . . vk are distinct, W is called a path. The
following figure illustrates a walk, a trail and a path in a graph.

Graph Theory September 30, 2020


_@-G__ 15 / 63
-3-8
Figure: Walk, trial,path in Graph G

Walk: u a v f y g w b v f y .
Trail: u e y f b w g y d x .
Path: u a v f y g w .

Graph Theory September 30, 2020 _so@


Thefts 16 / 63
Two vertices u and v of G are said to be connected if there is a (u, v )-path
in G. This connection is an equivalence relation on the vertex set V (G).
Thus, there is a partition of V (G) into non empty subsets V1 , V2 , . . . , Vk
such that two vertices u and v are connected if and only if both u and v
belongs to the same set Vi . The induced subgraphs ÈV1 Í, ÈV2 Í, . . . , ÈVk Í
are called the components of G. If G has exactly one component, G is
connected; otherwise G is disconnected. We denote the number of compo-
nents of G by Ê(G). In the following figure, G is disconnected with three
components where as H is connected.

Graph Theory September 30, 2020 -3-8


off-key 17 / 63
G H

Figure: A graph G with 3 components and Connected Graph H

A trail whose origin is same as terminus, is called a circuit and such a path
is called a cycle.

Graph Theory September 30, 2020 _-ze


-6-0-62 18 / 63
Let G be a graph with vertex set V (G) and edge set E (G). The comple-
ment of G, denoted by G is a graph with V (G) = V (G) and two vertices
are adjacent in G if and only if they are not adjacent in G.
v1 v1

v v6 v2
v6 2

v5 v5 v
3
v
3

v4 v
4

Figure: A graph G and its complement G

Graph Theory September 30, 2020


-3-8--0--833 19 / 63
A graph G is said to be self complementary if G is isomorphic to its
complements.
as

Figure: Self complementary graphs

Graph Theory September 30, 2020


---a---→- 20 / 63
-8-08
Degree of a vertex v in G, denoted by degG v is the number of vertices
adjacent to v in G.
A vertex in a graph G is said to be isolated when its degree is zero. A
vertex is said to be a pendant vertex if its degree is 1. The minimum degree
among the vertices of G is denoted by ”(G). The maximum degree among
the vertices of G is denoted by (G). In the following figure, degG v1 = 0,

%EB.IT#B keatABa.eg- f-
degG v2 = degG v6 = 2, degG v3 = degG v4 = 3, degG v5 = 1. Here, v1 is the
isolated vertex and v5 is the pendant vertex.
v2 v4

v5
V1

v3 v6
G

Figure: Degree of vertices of G

Graph Theory September 30, 2020 23 / 63


-_o-_
Definition:

Let G be a connected graph and let u, v œ V (G). A shortest path


between u and v in G is a (u, v )-path with minimum number of
edges in it.
The distance between u and v in G is the length of a shortest path
between them. The distance between u and v in G is denoted by
dG (u, v ).
Definitions:
In a connected graph G, eccentricity of a vertex v (denoted by
eG (v )) is defined as

eG (v ) = max {dG (v , u)}.


uœV (G)

Radius of G:
rad(G) = min {eG (v )}.
v œV (G)

Diameter of G:
diam(G) = max {eG (v )}.
v œV (G)

A vertex in G with minimum eccentricity is called a central vertex


in G.
The set of all central vertices in G is called the center of G.
Example 1:

eG (v1 ) = 1
eG (v2 ) = 2
eG (v3 ) = 2
eG (v4 ) = 2
eG (v5 ) = 2.
rad(G) = 1 and diam(G) = 2.
v1 is the central vertex in G.
Example 2:

eG (v1 ) = 4 eG (v5 ) = 2
eG (v2 ) = 4 eG (v6 ) = 3
eG (v3 ) = 3 eG (v7 ) = 4
eG (v4 ) = 2 eG (v8 ) = 4.
rad(G) = 2 and diam(G) = 4.
Center of G = {v4 , v5 }.
Example 3:

G
eG (v1 ) = 2
eG (v2 ) = 1
eG (v3 ) = 1
eG (v4 ) = 2
eG (v5 ) = 2.
rad(G) = 1 and diam(G) = 2.
Center of G = {v2 , v3 }.
Theorem
Result:
GABBAR
Let G be a (p, q) graph.The sum of the degrees of vertices of a graph G is
q
twice the number of edges, deg(v ) = 2q, v œ V

Proof.
Since every edge is incident with two vertices, each edge contributes 2 to
the sum of degrees of the vertices. Hence, the BEGGED
theorem.
result.

Graph Theory September 30, 2020


f_fdg-_ 24 / 63
-0--8
Theorem
Result:
ABABA
In any graph, the number of vertices of odd degree is even.

Proof.
Let Se = Sum of all degree of all even degree vertices. Let So = Sum of all
degree of all odd degree vertices. By definition, So + Se = 2q. i.e,
So = 2q ≠ Se = even. Each term in the sum So is odd. Therefore, So can
be even, only if even number of terms in So . Hence, the←BzBBzq-
theorem.
result.

Graph Theory September 30, 2020- Bet


__-fff- 25 / 63
A graph on n vertices, in which every two vertices are adjacent, is called a
complete graph and is denoted by Kn . A graph G in which every vertex is
of same degree is called a regular graph. When G is regular, ”(G) = (G)
and the common value is called regularity of G. A connected regular graph
with regularity two is called a cycle. A cycle on n vertices is denoted by Cn .
v v2 v v2
1 1

v3 v v3
v 6
6

v v4
v5 v 5
4

Figure: Cycle graph and Complete graph on six vertices

Graph Theory September 30, 2020 @Bg@


s---qgo_@ABB-I- 26 / 63
A bipartite graph is one whose vertex set can be partitioned into 2 subsets
X and Y so that each edge has one end vertex in X and one end vertex in Y .
Such a partition (X , Y ) is called a bipartition of the graph G. A complete
bipartite graph is a bipartite graph with bipartition (X , Y ) in which each
vertex of X is joined to each vertex of Y ; if |X | = m and |Y | = n, such a
graph is denoted by Km,n .
The graphs (a) and (b) below are complete bipartite and bipartite graphs
respectively.

Figure: Complete bipartite and bipartite graphs

Graph Theory September 30, 2020 -088ns


-0--0-3-06 27 / 63
<

Theorem
Result:
Browses
A graph is bipartite if and only if all its cycles are even.
of even length.
BE

Proof.
Let G be a connected bipartite graph. Then its vertex set V can be par-
titioned into two sets V1 and V2 such that every edge of G joins a vertex
of V1 with a vertex of V2 . Thus, every cycle v1 , v2 , ...vn , v1 in G necessarily
has its oddly subscripted vertices in V1 (say). i.e,v1 , v3 , ... œ V1 and other
vertices v2 , v4 , ... œ V2 . In a cycle v1 , v2 , ...vn , v1 : vn , v1 is an edge in G.
Since, v1 œ V1 we must have vn œ V2 . This implies n is even. Hence,the
length of the cycle is even.

Graph Theory September 30, 2020 tag


-0--8--8--3 28 / 63
Proof.
Conversly, suppose that G is a connected graph with no odd cycles. Let
\

u œ G be any vertex. Let V1 = {v œ V /d(u, v ) = even},


V2 = {v œ V /d(u, v ) = odd}. Then, V = V1 fi V2 , V1 fl V2 = . We
must prove that no two vertices in V1 and V2 are adjacent. Suppose that
x , w œ V1 be adjacent. w œ V1 ∆ d(u, w ) = 2k and
x œ V1 ∆ d(u, x ) = 2l. Thus, the path u ≠ w ≠ x ≠ u forms a cycle of
length 2k + 2l + 1, odd a contradiction. Therefore, x and w cannot be
adjacent. That is no two vertices in V1 are adjacent. Similarly we can
prove no two vertices in V2 are adjacent. Hence, the graph is bipartite.

Graph Theory September 30, 2020 --_fEg


___I-B___T_ 29 / 63
Complement of a complete graph on n vertices is called the totally discon-
nected graph. since it has no edges at all. A graph with a single vertex and
no edge is called trivial.
A graph G is said to be self centered if every vertex of G has the same
eccentricity. In such a graph, radius is equal to the diameter.
The cycle graph Cn is a self-centered graph and is the complete graph Kn .
Let G be a graph, v be a vertex in G and e be an edge in G. Then G ≠ {v }
or G ≠ v is the subgraph of G obtained by removing the vertex v and all
the edges in G which are incident with v , from the graph G. But G ≠ {e}
is a subgraph of G obtained by removing only the edge e from G.

Graph Theory September 30, 2020 --_@@


fast-food 30 / 63
Theorem
Result:
AMARA
For any Graph G with six vertices, G or G contains a triangle.

Proof.
Let G be a graph with six vertices. Let v be any vertex in G. Since v is
adjacent to other five vertices either in G or in G. We assume that, v is
adjacent with v1 , v2 , v3 in G. If any 2 of these vertices say v1 , v2 are
adjacent then v1 , v2 , v form a triangle in G. If no two of them are adjacent
in G then v1 , v2 , v3 are the vertices of a triangle in G.

Graph Theory September 30, 2020 -38g


-z@-TIBzB 31 / 63
Theorem
Result:
Bagg
Let G be a self complementary graph. Show that the number of vertices in
G is of the form 4n or 4n + 1.

Proof.
Let G be a (p, q) graph. Number of edges in Kp = p(p ≠ 1)/2 = pC2
Since G is self complementary, number of edges in G = number of edges
in G = q
Number of edges in Kp = number of edges in G + number of edges in G.
∆ Number of edges in G = p(p ≠ 1)/2 - q
∆ q = p(p ≠ 1)/2 ≠ q, ∆ 4q = p(p ≠ 1)
Therefore, q = p(p-1)/4
∆ 4/p or 4/(p ≠ 1)
∆ p = 4n or p ≠ 1 = 4n
∆ p = 4n or p = 4n + 1

Graph Theory September


_fg 30, 2020
_ofIf_ 32 / 63
BE
Theorem
Result:
BORGWARNER
If G has p vertices and minimum degree of a graph ”(G) > (p ≠ 1)/2,
then G is connected.

Proof.
Suppose that the graph G is disconnected. Let us assume that G has
two(or more) components say C1 and C2 . Suppose that a component C1
has a vertex of minimum degree (p ≠ 1)/2. Then, C1 must contain atleast
[(p ≠1)/2+1] vertices. Similarly, suppose that a component C2 has a vertex
of minimum degree (p ≠1)/2. Then, C2 must contain atleast [(p ≠1)/2+1]
vertices. Now, total number of vertices in G is equal to [(p ≠ 1)/2 + 1 +
(p ≠ 1)/2 + 1] = p ≠ 1 + 2 =p + 1 which is a contradiction to the fact that
G has p vertices. Hence, G is connected.

Graph Theory September


-_f-g 30, 2020 BAD
_g@- 33 / 63
Theorem
Result:
of@Eg-
-

If diam(G) Ø 3, then diam(G) Æ 3.

Proof.
Let x and y be any two vertices in G. Since diam(G) Ø 3, there exist
vertices u and v at distance 3 in G. Hence, uv is an edge in G. Since u
and v have no common neighbour in G, both x and y are each adjacent to
u or v in G. It follows that d(x , y ) Æ 3 in G and hence d(G) Æ 3)

Graph Theory September 30, 2020 Bats


--_@g@Ts_ 34 / 63
Theorem
Result:
BEAKER
Every nontrivial self complementary graph has diameter 2 or 3.

Proof.
Let G be a self complementary graph. Clearly, G cannot have diameter 1.
Since G ≥= Kn which is not self complementary graph. Hence, self
complementary graphs have diameter atleast 2. Suppose that
diam(G) > 3. By the above goes
theorem,
result diam(G) Æ 3. Hence, diameter of
every self complementary graph is either 2 or 3.

Graph Theory September 30, 2020


-0--0--8--86 35 / 63
Theorem
Result:
BEBE
For any graph G, show that either G or G is connected.

Proof.
If G itself is connected, there is nothing to prove. Suppose that the graph
G is disconnected and has two components C1 and C2 . Let u and v be
any two vertices, we have the following cases.
(i) If u and v are in different components and are not adjacent in G.Then
u and v are adjacent in G. We have, uv path, hence G is connected.
(ii) If u and v belong to the same component but they are not adjacent
in G. Hence, they are adjacent in G. Hence, we have uv path.
(iii) Suppose that u and v are adjacent in G(Obviously, they belong to the
same component).Then we can find w in another component (which
does not contain u and v ). We have a uv path via w in G. That is,
u ≥ w and v ≥ w .

Graph Theory September 30, 2020


-0--0--8--8603 36 / 63
A cut vertex of a graph is one whose removal increases the number of
components and bridge is such an edge. A non separable graph is connected,
nontrivial,and has no cut vertices. A block of a graph is a maximal non
separable sub graph. We note that every non trivial connected graph has at
least two vertices which are not cut vertices.

Graph Theory September 30, 2020 -@-z-


off-Beat 37 / 63
For a graph G with V (G) = {v1 , v2 , . . . , vn }, the adjacency matrix of G,
denoted by A(G) is the n ◊ n matrix defined as follows. The rows and
columns of A(G) are indexed by V (G). If i ”= j then the (i, j)th ≠ entry of
A(G) is 0 for vertices vi and vj non adjacent, and (i, j)th ≠ entry of A(G)
is 1 for vertices vi and vj adjacent. The (i, i)th ≠ entry of A(G) is 0 for
i = 1, 2, . . . , n. We often denoted by A(G) or simply A.
V
1

V
V
5 2 S T
0 1 0 0 1
W1 0 1 0 0X
W X
W X
A(G)= W0 1 0 1 0X
V V
4 3
W X
U0 0 1 0 1V
1 0 0 1 0
Figure: Graph G and its adjacency matrix A(G)

Graph Theory September 30, 2020 Agat


-②f-@-Ef__ 38 / 63
Trees

An acyclic is one that contains no cycles. It is also called a forest.


A tree is a connected acyclic graph. In a tree, any two vertices are connected
by a unique path. All the trees on six vertices are given below.

Figure: Trees

Graph Theory September 30, 2020 BABE


o@G__--__oIf__ 39 / 63
If G is a (n, m) tree then m = n ≠ 1. Every non trivial tree has at least two
vertices of degree one(pendant vertices). A tree with exactly two vertices
of degree one is a path. A tree in which all the vertices except one is of
degree one is called a star. If G is a tree with (G) Ø k, then G has at
least k vertices of degree 1. Center of a tree contains either a single vertex
or two adjacent vertices. Accordingly, a tree is called unicentral or bicentral.
Every simple graph G with ”(G) Ø k has a subgraph isomorphic to a tree
on (k + 1) vertices. A connected graph is a tree if and only if every edge of
the graph is a cut edge or bridge.
A spanning tree of G is a spanning subgraph of G that is a tree. We
note that every connected subgraph has a spanning tree. Hence, if G is a
connected (n, m) graph then m Ø n ≠ 1.

Graph Theory September 30, 2020 Off


-8-3--8--20 40 / 63
Theorem
Result:
BOEGER
A graph G is a tree if and only if between every pair of vertices there exist
a unique path.

Proof.
Let G be a tree then G is connected. Hence, there exist atleast one path
between every pair of vertices. Suppose that between two vertices say u and
v , there are two distinct paths then union of these two paths will contain
a cycle; a contradiction. Thus, if G is a tree, there is atmost one path
joining any two vertices. Conversly, suppose that there is a unique path
between every pair of vertices in G.Then G is connected. A cycle in the
graph implies that there is atleast one pair of vertices u and v such that
there are two distinct paths between u and v . Which is not possible because
of our hypothesis. Hence, G is acyclic and therefore it is a tree.

Graph Theory September 30, 2020 eggs


reheated 41 / 63
Theorem
Result:
BAHAMA
A tree with p vertices has p ≠ 1 edges.

Proof.
TheBB←BBoBBz@
theorem
result will be proved by induction on the number of vertices.
If p = 1, we get a tree with one vertex and no edge. If p = 2, we get a tree
with two vertices and one edge. If p = 3, we get a tree with three vertices
and two edges. Assume that, the statement is true with all tree with k
vertices (k < p). Let G be a tree with p vertices. Since G is a tree there
exist a unique path between every pair of vertices in G. Thus, removal of an
edge e from G will disconnect the graph G. Further, G ≠e consists of exactly
two components with number of vertices say m and n with m +n = p. Each
component is again a tree. By induction, the component with m vertices
has m ≠ 1 edges and the component with n vertices has n ≠ 1 edges. Thus,
the number of edges in G = m ≠ 1 + n ≠ 1 + 1 = m + n ≠ 1 = p ≠ 1.

Graph Theory September 30, 2020


-_EI@ez_a__-_ 42 / 63
Theorem
Result:
BEAMED
Every tree has a center consisting of either one vertex or two adjacent
vertices.

Proof.
The result is obvious for the trees K1 and K2 . We show that any other
tree T has the same central vertices as the tree T1 obtained by removing
all end vertices of T . Clearly, the maximum of the distances from a given
vertex u of T to any other vertex v of T will occur only when v is an end
vertex. Thus, the eccentricity of each vertex in T1 will be exactly one less
than the eccentricity of the same vertex in T . Hence, the vertices of T
which possess minimum eccentricity in T are the same vertices having
minimum eccentricity in T1 . That is, T and T1 have the same center.

Graph Theory September 30, 2020


toe-to-Toe 43 / 63
_gE-
Proof.
Boss
If the process of removing end vertices is repeated, we obtain successive
trees having the same center as T . Since T is finite, we eventually obtain
a tree which is either K1 or K2 . In either case all vertices of this ultimate
tree constitute the center of T which consists of just a single vertex or of
two adjacent vertices.

Graph Theory September 30, 2020


-8--88--0-8 44 / 63
A walk that traverses every edge of G exactly once, goes through all vertices
and and ends at the starting vertex is called Eulerian circuit or
Eulerian cycle. A graph G is said to be Eulerian if it has an Eulerian cycle.
v1

v6 v7 v8 v2

V
12 V9

v5 v
3
V V10
11

v4

Figure: An Eulerian graph

Graph Theory September 30, 2020


-0--0--8--808 45 / 63
Theorem
Result:
oooo
A non empty connected graph is Eulerian if and only if all of its vertices •
of
even degree.
tegmark
have even degree.

Proof.
Suppose that G is connected and Eulerian. Since G has an eulerian circuit
which passes through each edge exactly once,goes through all vertices and
all of its vertices are of even degree.
Conversly, Let G be a connected graph such that every vertex of G is of even
degree. Since, G is connected, no vertex can be of degree zero. Thus, every
vertex of degree Ø 2, so G contains a cycle. Let C be a cycle in a graph
G. Remove edges of the cycle C from the graph G. The resulting graph
(say G1 ) may not be connected, but every vertex of the resulting graph is
of even degree.

Graph Theory September 30, 2020


-0--200--2--36 46 / 63
Proof.
Motya
Suppose G consists only of this cycle C , then G is obviously Eulerian. Oth-
erwise, there is another cycle C1 with a vertex v in common with C . The
walk beginning at v and consisting of the cycles C and C1 in succession is
a closed trial containing the edges of these two cycles. By continuing this
process, we can construct a closed trial containing all edges of G, hence G
is Eulerian.

Graph Theory September 30, 2020


-@A@fg@- 47 / 63
-06A
A path that contains every vertex of G is called a Hamilton path of G;
similarly, a Hamilton cycle of G is a cycle that contains every vertex of G.
A graph is Hamiltonian if it contains a Hamilton cycle.

20 19

9 10

8 11
1 7
2
3
6
4
12
5

13 18
15 14
16
17

(b)
(a)

Figure: Hamiltonian and Non hamiltonian graphs

The dodecahedron in figure (a) is Hamiltonian. The Herschel graph in figure


(b) is non hamiltonian.

Graph Theory September 30, 2020 @Af-


-80-8-2--0 48 / 63
Algorithm
BASH Some notations:

Shortest paths in graphs: The graph G has n vertices and a distance


associated with each edge of the graph G(such a graph is often called a
network). The representation of the network will be as a distance matrix D.
The distance matrix D = (dij ) where, dij = 0 , if i = j.
dij = Œ, if i is not joined to j by an edge.
dij = distance associated with an edge from i to j, if i is joined to j by an
edge.

Graph Theory September 30, 2020 @g@-


-8--6--20--6 49 / 63
We shall find the shortest distance between the vertices of a graph G using
DijkstraÕ s algorithm.
Let us define two sets K and U, where K consists of those vertices which
have been fully investigated and between which the best path is known,
and U of those vertices which have not yet been processed. Clearly, every
vertex belongs to either K or U but not both. Let a vertex r be selected
from which we shall find the shortest paths to all the other vertices of the
network. Let the array bestd(i) hold the length of the shortest path so far
formed from r to vertex i, and another array tree(i) the next vertex to i on
the current shortest path.

Graph Theory September 30, 2020


-8--66602--3-0 50 / 63
DijkstraÕ s algorithm:
Step 1: Intialise K = {r }, U={ all other vertices of G except r }. Set
bestd(i)= dri and tree(i)= r .
Step 2: Find the vertex s in U which has the minimum value of bestd.
Remove s from U and put it in K .
Step 3: For each vertex u in U, find bestd(s) + dsu and if it is less than
bestd(u) replace bestd(u) by this new value and let tree(u)= s.(a shorter
path to u has been found by going via vertex s.)
Step 4: If U contains only one vertex then stop the process or else go to
step 2. The array bestd(i) contains the length of shortest path from r to i.

Graph Theory September 30, 2020


-0080--080--03--83 51 / 63
Dijkstra’s Algorithm (Explicit)

Step 1: Initialize K = {r }, U = V (G) \ {r }.


For each i: set bestd(i) = dri ,
tree(i) = r .
Step 2: Find s œ U which has the minimum value of bestd.
U = U \ {s},
K = K fi {s}.
Step 3: For each u œ U:
If bestd(s) + dsu < bestd(u):
bestd(u) = bestd(s) + dsu
tree(u) = s.
Step 4: If | U |= 1: STOP.
Else: Go back to Step 2.
Example: Implement DijkstraÕ s algorithm to find shortest path from the
vertex B to all other vertices of following graph G.
12

B
C
5
7 3
A
10 8
4 5

S T
6 6
E 0 7 Œ 6 Œ
0 5 10X
D WŒ
11 W Œ X
W X
D(G) = W 12 6 0 Œ 3X
W X
U 4 5 Œ 0 6V
11 Œ 8 Œ 0
Figure: Graph G and its distance matrix D(G)

Graph Theory September 30, 2020


-0--30--80--8004 52 / 63
(1) K = {B}, U = {A, C , D, E }.

Vertex in U A C D E
bestd Œ 5 Œ 10
tree B B B B

(2) min bestd = 5; s = C .


U = {A, D, E }, K = {B, C }.

(3) u = A: bestd(C ) + dCA = 5 + 12 = 17 < Œ = bestd(A).


Update: bestd(A) = 17, tree(A) = C .
u = D: bestd(C ) + dCD = 5 + Œ ⌅ Œ = bestd(D).
u = E : bestd(C ) + dCE = 5 + 3 = 8 < 10 = bestd(E ).
Update: bestd(E ) = 8, tree(E ) = C .

Vertex in U A D E
bestd 17 Œ 8
tree C B C
(4) min bestd = 8; s = E .
U = {A, D}, K = {B, C , E }.

(5) u = A: bestd(E ) + dEA = 8 + 11 = 19 ⌅ 17 = bestd(A).


u = D: bestd(E ) + dED = 8 + Œ ⌅ Œ = bestd(D).

Vertex in U A D
bestd 17 Œ
tree C B

(6) min bestd = 17; s = A.


U = {D}, K = {A, B, C , E }.

(7) u = D: bestd(A) + dAD = 17 + 6 = 23 < Œ = bestd(D).


Update: bestd(D) = 23, tree(D) = A.

Vertex in U D
bestd 23
tree A

(8) | U |= 1. Hence STOP.


The shortest path from B to all the vertices of G is given by
Vertex A B C D E
bestd 17 0 5 23 8
tree C B B A C
Example: Implement DijkstraÕ s algorithm to find shortest path from c to
all other vertices of the following network.

S T
0 5 6 Œ 17 Œ
W3 0 4 Œ Œ 7X
W X
WŒ Œ 0 6 Œ 11X
W X
D(G) = W X
W11 Œ 7 0 9 4X
W X
UŒ Œ Œ Œ 0 5V
11 Œ Œ 9 4 0
Figure: GraphG and its distance matrix D(G)

Graph Theory September 30, 2020 @-@g→


_@--__@f_@- 56 / 63
(1) K = {c}, U = {a, b, f , g, h}.

Vertex in U a b f g h
bestd Œ Œ 6 Œ 11
tree c c c c c

(2) min bestd = 6; s = f .


U = {a, b, g, h}, K = {c, f }.

(3) u = a: bestd(f ) + dfa = 6 + 11 = 17 < Œ = bestd(a).


Update: bestd(a) = 17, tree(a) = f .
u = b: bestd(f ) + dfb = 6 + Œ ⌅ Œ = bestd(b).
u = g: bestd(f ) + dfg = 6 + 9 = 15 < Œ = bestd(g).
Update: bestd(g) = 15, tree(g) = f .
u = h: bestd(f ) + dfh = 6 + 4 = 10 < 11 = bestd(h).
Update: bestd(h) = 11, tree(h) = f .

Vertex in U a b g h
bestd 17 Œ 15 10
tree f c f f
(4) min bestd = 10; s = h.
U = {a, b, g}, K = {c, f , h}.

(5) u = a: bestd(h) + dha = 10 + 11 = 21 ⌅ 17 = bestd(a).


u = b: bestd(h) + dhb = 10 + Œ ⌅ Œ = bestd(b).
u = g: bestd(h) + dhg = 10 + 4 = 14 < 15 = bestd(g).
Update: bestd(g) = 14, tree(g) = h.

Vertex in U a b g
bestd 17 Œ 14
tree f c h

(6) min bestd = 14; s = g.


U = {a, b}, K = {c, f , g, h}.

(7) u = a: bestd(g) + dga = 14 + Œ ⌅ 17 = bestd(a).


u = b: bestd(g) + dgb = 14 + Œ ⌅ Œ = bestd(b).
Vertex in U a b
bestd 17 Œ
tree f c

(8) min bestd = 17; s = a.


U = {b}, K = {a, c, f , g, h}.

(9) u = b: bestd(a) + dab = 17 + 5 = 22 < Œ = bestd(b).


Update: bestd(b) = 22, tree(b) = a.
Vertex in U b
bestd 22
tree a

(10) | U |= 1. Hence STOP.

The shortest path from c to all the vertices of G is given by


Vertex a b c f g h
bestd 17 22 0 6 14 10
tree f a c c h f
References

[1] Frank Harary, Graph Theory, Addison-Wesley Publishing Company,


Inc, 1969.
[2] E S Page and L B Wilson, An introduction to Computational
Combinatorics, Cambridge University Press, Inc, 1979.

[3]

Graph Theory September 30, 2020


-8--8--830--0 62 / 63

You might also like