UNIT 4 Graph theory

advertisement
Graph Theory
Unit: 4
General Information
Exam. Scheme:
1. Online(MCQ) : 50 Marks.
2. Offline(Problems) : 50 Marks.
Total number of lecture allocated = 08.
Methodology: Traditional (Chalk-Board).
Books : C.L.Liu
Graph Theory
 A graph G is an ordered pair (V,E) where V is the
set of vertices and E is the set of edges.
 Each edge is associated with an unordered pair
(vi , vj). The vertices Vi & vj are called the end vertices or
the terminal vertices of the edge Eij.
Basic Terminology
 Incident : An edge is said to be incident with the vertices it
joins.
 Adjacent : Two vertices are said to be adjacent if they are
joined by an edge.
 Two edges are said to be adjacent if they are joined by
common vertices.
 Degree of Vertices: No. of edges incident on a particular
vertex are called degree of that vertex.
 Indegree & Outdegree: Number of edges incident on to a
vertex & number of vertex incident out of a vertex.
Basic…..
 Loop: If the initial vertex vi and the terminal vertex vj
are same for an edge eij, then eij are called self loop or
simply loop.
 Parallel edges: If there are more than one edges
associated with a given pair of vertices then those
edges are called parallel edges or multiple edges.
 Isolated Vertex: A vertex is said to be isolated vertex if
no edge is incident on it.
 Pendant vertex: A vertex with degree 1 is called a
Pendant vertex.
Representation of graph
 Adjacent matrix.
 Incidence Matrix.
Adjacent Matrix
A
B
C
D
E
A B C D E
0 1 1 1 0
1 0 1 1 0
1 1 0 0 1
1 1 0 0 1
0 0 1 1 0
E
e
C
c
g
a
B
b
A
f
d
D
Incidence Matrix
a b c d e
----------------------------A 1 1 0 1 0
B 0 1 1 0 0
C 1 0 1 0 1
D 0 0 0 1 0
E 0 0 0 0 1
E
e
C
c
g
a
B
b
A
f
d
D
Types of Graph
Directed Graph: A directed graph G is defined
as an ordered pair (V,E) ,where V is the set of
vertices and E is the set of edges.
Each edge or arc ek ={vi,vj} is represented by an
arrow ,starting from initial point vi to the
terminal point vj.
Types…
Weighted Graph: A graph G is said to be a
weighted graph if each edge of the graph is
assigned with some positive real number
(w),called the weight.
Types..
Simple Graph: A graph is said to be a simple
graph if it does not contain neither the self
loops nor the parallel edges.
Finite & Infinite graph : A graph with finite
number of edges & vertices and a graph with
infinite number of edges & vertices.
 Null Graph: If the edge set of any graph G with n vertices is an
empty set then the graph is called a null graph.
 Complete graph: A graph G is called a complete graph if every
vertex in G is connected with every other vertex ie degree of
each vertex should be n-1.
Denoted by Kn
Total no of edges =n(n-1)/2
 Regular graph: If degree of all the vertex of a
graph G is same say”d” then it is called regular
graph.
 Every Complete graph Kn is a regular graph
of degree n-1 but vice versa is not true
Multi graph
A graph having self loop & Parallel edges are
called multi graph or Multiple graph.
 Bipartite Graph :A graph G with vertices V and edges E are called bipartite
graph if its vertex set can be partitioned in two set such that
i)
V1 U V2= V
ii) V1 Π V2= ф
iii) Each edge should join from V1 to V2.
 Complete bipartite Graph : if each vertex of V1 is joined to every vertex
of V2by an unique edge.

Denoted by Kmn

Total number of edges =m*n ,

Regular graph if m=n
Acyclic Graph : A graph without cycle is called
acyclic.
 Trivial Graph : A graph with single vertex and
no edges are called trivial graph.
Isomorphic Graph
 Two graphs are said to be isomorphic if there
is one to one correspondence between their
vertices and their edges such that incidencies
& adjacency are preserved.
Must have condition for isomorphism:
i) Same no. of vertices
ii) Same no. of edges
iii) Same no. of vertices with a given degree.
Example
•
•
•
•
•
•
•
•
f(a) = 1
f(b) = 6
f(c) = 8
f(d) = 3
f(g) = 5
f(h) = 2
f(i) = 4
f(j) = 7
Q: Find whether K6 & K3,3 are isomorphic or not ?
Subgraph
 If G(V,E) be any graph then a graph G’(V’,E’) is said to
be a subgraph of G if E’ ⊆ E and V’ ⊆ V.
 Complement of a subgraph G’(V’,E’) with
respect to the graph G is another G’’(V’’,E’’)
such that E’’=E-E’ and V’’ contains only those vertices
with which the edges in E’’ are incident.
 Spanning Subgraph: A subgraph which contains all the
vertex of G
 Edge disjoint subgraph: No common edge in two
subgraph .
 Vertex disjoint subgraph : No common vertex in two
subgraph.
 Factor of a graph : A k-factor of a graph is defined to be
a spanning subgraph of the graph with the degree of
each of its vertex being k.
 Exercise .
Planar graph
A Graph G is said to be a planar graph if it can
be drawn on a plane without intersecting the
edges except at the common vertices.
Euler’s Formula.
For any connected planar graph v-e+r=2
V= no. of vertices.
e= no. of edges.
r= no. of regions.
 Theorem1: If G(V,E) is a simple connected graph
then
e ≤ 3v-6
 Theorem2: e ≤ 2v-4
Examples
Are K5 , K6 and K3,3 are planar ?
Operations on Graph
 Union: If G1(V1,E1) and G2(V2,E2) are two graphs
then union G3=G1UG2,whose vertex set is V3=
V1UV2 and edge set E3 = E1UE2.
 Intersection: If G1(V1,E1) and G2(V2,E2) are two
graphs then intersection G3=G1ΠG2,whose
vertex set is V3= V1 Π V2 and edge set E3 = E1 Π
E2.
 Ring sum: If G1(V1,E1) and G2(V2,E2) are two
graphs then ringsum G3=G1⊕G2,whose vertex
set is V3= V1 ⊕ V2 and edge set E3 = E1 ⊕ E2.
 Complement of a graph: Complement of a graph
G, denoted by G’ is the graph whose vertex set
are same as the vertex set of G but two vertex are
adjacent if they are not adjacent in G.
 Complement of a complete graph is always null
graph.
 Self complementary graph : If it is isomorphic to
its complement.
Handshaking Lemma
The sum of the degree of all vertices in a graph
G is twice the number of edges.
or
Σ d(vi)= 2e, i= 1….n
Exercise
Q1. Show that the maximum degree of any vertex in a simple graph
with n vertice is n-1.
Q2. Show that the max. number of edges in a simple graph with n
vertices is n(n-1)/2.
Q3.How many nodes are require to construct a graph with exactly 6
edges in which each node is of degree 2.
Q4. Is it possible to construct a graph with 12 nodes such that 2 of the
nodes have degree 3 and remaining nodes have the degree 4.
Q5. Is it possible to draw a simple graph with 4 vertices and 7 edges.
Paths & Circuit
Path: Let G=(V,E) be any graph and let V0 and Vnbe any two
vertices in V. A path of length n from V0 to Vn is a sequence of
vertices & edges of the form(v0,e1,v1,e2…..envn) where each edge ej
is an edge between Vj-1 & vj .The vertices Vo & Vn are called the
end vertices & remaining are called interior vertices.
 Simple path : No repetition of edges.
 Elementary path: No repetition of vertices .
Circuit: A path becomes a circuit if vo=vn
C=(v0 ,e1,v1,…..vn)
Simple Circuit: No repetition of edges.
Elementary circuit: No repetition of vertices
Eulerian paths & Ckt.
 A path is called an eulerian path if every edge
of the graph G appears exactly once in the
path.
 A circuit which contains every edge of the
graph G exactly once is Eulerian ckt.
Theorems
 A graph contains an eulerian path if and only if it
is connected and has either zero or two vertices
of odd degree.
 A graph contains an eulerian ckt if and only if it is
connected and its all vertices are of even degree.
 A directed graph contains an eulerian ckt if it is
connected and the incoming degree of every
vertex is equal to outgoing degree .
Verify
Exercise
Under what condition Kmn(Complete bipartite
graph) will have an eulerian ckt ?
Case1: m=n & both are even.
Case2: m=n & both are odd.
Case3: m≠n & both are even.
Case4: m ≠n & one is even & one is odd.
Hamilton paths & Ckt
 A path in a connected graph G is a hamilton path if it
visit every vertex G exactly once.
 A ckt in a connected graph G is called a hamilton ckt if
it visit every vertex of G exactly once.
 Theorem1: If the sum of the degree for each pair of
vertex is ≥ n-1, then there exist a hamilton path.
 Theorem2: If the degree of each vertex in G ie
d(v) ≥ n/2 , then G will contain hamilton ckt.
Verify
Exercise
 Find a hamilton path and a hamilton circuit in
K4,3 .
 It has a hamilton path but not the hamilton
ckt.
Shortest path algorithm
Assumptions:
 Let G(V,E) be a simple connected graph .
 Let a and z be two vertices of the graph.
 L(x) denote the label of vertex x which
represent the length of the shortest path from
vertex a to vertex x.
 Wij denote the weight of the edge eij=(vi,vj)
Algorithm
 Step1: P is the set of those vertices which have the
permanent labels, so P={ф}
T= { all vertices of graph G}
Set L(a)=0 ,L(x) =∞ ∀ x ∈ T and x ≠ a.
 Step 2: Select the vertices v in T which has the smallest
labels. This label will be the permanent label of v.
Set P=PU{v} and T =T-{v}
If v=z ,then L(z) is the length of the shortest path from the
vertex ato z and stop.
Step3: If v ≠ z,then revise the labels of vertices
of T. The new label of a vertex x in T is given by
L(x) =min{old L(x) , L(v) + w(v,x)}
Where w(v,x) is the weight of the edge joining
the vertex v and x.If no direct edge then
w(v,x)= ∞
Step 4: Repeat step 2 & step 3 untill z gets the
permanent labels.
Coloring of a Graph.
One of the main way is to color the vertices of G such that no
two adjacent vertices have the same color. It is called proper
coloring.

Chromatic number: The chromatic number of a graph G is
the minimum number of colors required for the proper
coloring of the graph G.
In this case
=3
This graph is called 3- chromatic
Chromatic no. of some commonly
used graph
Sr. No.
Type of graph G
Chromatic no. K(G)
1.
Complete graph Kn
n
2.
Star graph Cn, n>1
2
3.
Cycle graph Cn , n>1
2 for n is even
3 for n is odd
4.
Wheel graph Wn, n >2
3 for n is odd
4 for n is even
Some observations
 A graph which has only isolated vertex has K(G)=1.
 A graph with one or more edges (Without a self loop) has
a minimum K(G)=2.
 A graph consisting of simply one circuit with n≥3 vertices
has K(G)=2 if n is even and K(G)=3 if n is odd.
 Every tree with two or more vertices has K(G)=2.
 If d is the maximum degree of the vertices in a graph
G,then K(G)≤ d+1
Application of graph Theory
 Konigsberg Bridge Problem:
Start from any four land area walkover the seven
bridges exactly once.
Vertices represent the land area and edges represent the
bridge.
Euler prove that solution of this problem does not exist.
 Utility problem: Three houses H1 ,H2,H3 &
three utilities W , G & E.Is it possible to
provide such a connection without any
crossover.
This graph can’t be drawn on a plane without
crossing the edges.
Thank you
Download