You are on page 1of 20


Nitin Upadhyay
February 27, 2006
Bits-Pilani Goa campus
 What is a Graph?

 Applications of Graphs

 Categorization

 Terminology
Special Graph Structures

Special cases of undirected graph structures:

 Complete graphs K

 Cycles Cn
 Wheels Wn
 n-Cubes Qn
 Bipartite graphs
 Complete bipartite graphs Km,n
Graph Representations

 Adjacency-matrix representation
 Incidence matrix representation
 Edge-set representation
 Adjacency-set representation
 Adjacency List
Graph Isomorphism

 Formal definition:
 Simple graphs G1=(V1, E1) and G2=(V2, E2) are
isomorphic if there is a function f:V1→V2 such that
 f is one-to-one .
 f is onto, and
 ∀ a,b∈V1, a and b are adjacent in G1 iff f(a) and
f(b) are adjacent in G2.
 f is the “renaming” function that makes the two
graphs identical.
Graph Invariants under
Necessary but not sufficient conditions for
G1=(V1, E1) to be isomorphic to G2=(V2, E2):
 |V1|=|V2|, |E1|=|E2|.
 The number of vertices with degree n is the same
in both graphs.
 For every proper subgraph g of one graph, there
is a proper subgraph of the other graph that is
isomorphic to g.
Isomorphism Example

 If isomorphic, label the 2nd graph to show the

isomorphism, else identify difference.

b d * Same # of
a b a* Same # of
d c
e•Same # of
e c f degrees for
f all vertices
Hence, they are isomorphic!
Are These Isomorphic?

 If isomorphic, label the 2nd graph to show the

isomorphism, else identify difference.
* Same # of
a vertices
* Same # of
* Different
# of verts of
c e degree 2!
Hence, they are NOT isomorphic! (1 vs 3)

 A subgraph of a graph G=(V, E) is a graph

H=(W, F) where W⊆V and F⊆E.

Spanning Subgraph

 A subgraph H= (W, F) of G= (V, E) is called a

spanning subgraph of G iff:
 W(H)=V(G)
 F(H) ⊆ E(G)


 In an undirected graph, a path of length n

from u to v is a sequence of n adjacent edges
going from vertex u (=x0) to vertex v (=xn).
 A path is a circuit if u=v and n > 0.
 A path pass through the vertices x1, x2,.., xn-1,
or traverses the edges e1, e2, …, en.
 A path is simple if it does not contain the
same edge more than once.
Path Example
 a, d, c, f, e is a simple
path of length 4.
a b c  d, e, c, a is not a path
since {e, c} is not an edge.
 b, c, f, e, b is a circuit of
length 4 since this path
begins and ends at b.
 Path a, b, e, d, a, b is not
a simple path since it
contains the edge {a, b}
d e f twice.
Counting Paths and
Adjacency Matrices

 Let A be the adjacency matrix of graph G.

 The number of paths of length k from vi to vj

is equal to (Ak)i,j. (The notation (M)i,j denotes
mi,j where [mi,j] = M.)
Counting Paths Example

 How many paths of Hence, the number

8 0 0 8 aa bb
length 4 are there of paths ofA length
0 8 8 0
4 
0 8 8 0
4 from a to d8is0 the 
from a to d in the right 0 8
a b (1, 4)th entry of A4.
graph? cc
Since 8 0 0 8 dd
 The adjacency matrix 0 8 8 0
of the graphcis A4 = 
d 0 8 8 0
 
0 1 1 0 8 0 0 8
1 0 0 1 There are 8 paths of length
A = 
1 0 0 1 4 from a to d.
 
0 1 1 0
Euler & Hamilton Paths

 An Euler circuit in a graph G is a simple

circuit containing every edge of G.
 An Euler path in G is a simple path
containing every edge of G.
 A Hamilton circuit is a circuit that traverses
each vertex in G exactly once.
 A Hamilton path is a path that traverses each
vertex in G exactly once.
Some Useful Theorems

 A connected multigraph has an Euler circuit

iff each vertex has even degree.
 A connected multigraph has an Euler path
(but not an Euler circuit) iff it has exactly 2
vertices of odd degree.
 If (but not only if) G is connected, simple, has
n≥3 vertices, and ∀v deg(v)≥n/2, then G has
a Hamilton circuit.s
Paths in Directed Graphs

 Same as in undirected graphs, but the path

must go in the direction of the arrows.
Graph Unions

 The union G1∪G2 of two simple graphs

G1=(V1, E1) and G2=(V2,E2) is the simple
graph (V1∪V2, E1∪E2).
Graph Union Example

 Find the union of the graphs G1 and G2

shown below.
The vertex set of the union G1∪G2 is the union of the
two vertex sets, namely {a, b, c, d, e, f}. The edge
set of the union is the union of the two edge set.
a b c a b c a b c

d e d f d e f
G1 G2 G1 ∪ G2

Questions ?