Graph Theory
Graph Theory
By:Ms N. S. Khairnar
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.
● 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.
● Adjacent matrix.
● Incidence Matrix.
Adjacent Matrix
A B C D E
E
A 0 1 1 1 0 e
B 1 0 1 1 0 C
C 1 1 0 0 1 c
a g
D 1 1 0 0 1 B
b f
E 0 0 1 1 0
A d
D
Incidence Matrix for Undirected Graph
a b c d e
E
A 1 1 0 1 0 e
B 0 1 1 0 0 C
C 1 0 1 0 1 c
D 0 0 0 1 0 a g
E 0 0 0 0 1 B
b f
A d
D
Incidence Matrix for Directed Graph
Types of Graph
● Multigraph
● Pseudograph
● Directed Graph
● Weighted Graph
● Finite and Infinite Graph
● Null Graph
● Simple Graph
● Complete Graph
● Regular Graph
● Bipartite Graph
● Complete Bipartite Graph
● Acyclic Graph, Trivial Graph
Multigraph, Pseudograph
● A Multigraph is a graph which is permitted to have multiple
edges/parallel edges.
● Self Loops are not allowed in Multigraph.
● A Pseudograph allows Self Loops as well.
● Following figure represents Pseudograph.
Directed Graph
● A graph with infinite number of edges & vertices is called as Infinite Graph.
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.
Simple Graph
● A simple graph is a graph that does not have more than one edge
between any two vertices and no edge starts and ends at the
same vertex.
Yes
Complete Bipartite Graph
● A special kind of bipartite graph where every vertex of the
first set is connected to every vertex of the second set.
● Denoted by Kmn
● Total number of edges =m*n ,
Acyclic ,Trivial Graph
1 factor:
Graph G:
2 Factor:
Isomorphic Graph
Ring Sum
Intersection
Complement of A Graph
G Complement
G
Handshaking Lemma
● Theorem2: e ≤ 2v-4
Examples
● 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.
● A graph contains an eulerian ckt if and only if it is connected and its all
vertices are of even degree.
● Directed Graph possess an eulerian path, iff the incoming degree of every
vertex is equal to outgoing degree with the possible exception of 2 vertices, for
these two vertices indegree of one is 1 more than its outgoing degree and the
incoming degree of other is one less than its outgoing degree.
3 C 4 even
4 D 3 odd
5 E 2 even
6 F 4 even
7 G 2 even
Does Following graph posses an Eulerian Path and Circuit?
2 4 even
3 2 even
Eulerian Circuit: Exists
4 2 even
261524132
5 2 even
6 2 even
Exercise
● 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
circuit.
● Note: There are no necessary and sufficient conditions for Hamiltonian Path and
Circuit.
Exercise
n= even, 2 Chromatic
n= odd, 3 Chromatic
Wheel Graph
A wheel graph is a graph formed by connecting a single universal vertex
to all vertices of a cycle.
Wheel Graph with even vertices
1 1
4 5
4
2
2 3
3
● L(x) denote the label of vertex x which represent the length of the shortest
path from vertex a to vertex x.
● 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}
For the remaining vertices in T find shortest path from a.
If v=z ,then L(z) is the length of the shortest path from the vertex a to z and
stop.
Dijkstra’s Algorithm
● Step3: If v ≠ z,then revise the labels of vertices of T. The new label of a
vertex x in T is given by
● Step 4: Repeat step 2 & step 3 until z gets the permanent label.
Example
Find Shortest path from a to z Step:1
P={Φ}
T={a,b,c,d,e,f,z}
L(a)=0
L(x)=∞, ∀ x ∈ T and x ≠ a.
Step:2, v=a , L(a)=0
T={b,c,d,e,f,z}
T={b,d,e,f,z}
T={b,d,e,z}
T={b,d,z}
T={d,z}
T={z}
T={ }
✔ 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.
B
B
A D A D
D C
Vertices represent the land area and edges represent the bridge.
Euler prove that solution of this problem does not exist.
Applications of graph Theory
● Utility problem: Three houses H1 ,H2,H3 & three utilities
W ,G & E.Is it possible to provide such a connection
without any crossover.