You are on page 1of 18

Review of Graph Theory

Gaurav S. Kasbekar
Dept. of Electrical Engineering
IIT Bombay

1-1
Reference
 Bertsekas and Gallager, Section 5.2.

1-2
Graph

❑ Graph: G = (𝒩, ℰ)
❑ 𝒩 = set of nodes, e.g., {1, 2, 3, 4}
❑ ℰ = set of edges, e.g., {(1,2), (1,4), (2,4), (2,3)}
o edge: pair of distinct nodes from 𝒩
❑ Locations of nodes and shapes of edges in
pictorial representation irrelevant
4-3
Assumptions
 Both ends of an edge cannot be on same
node
 Multiple edges not allowed between given
pair of nodes

5-4
Path
 A sequence of distinct nodes 𝑛1 , 𝑛2 , … , 𝑛𝑙 from
𝒩 such that (𝑛𝑖 , 𝑛𝑖+1 ) ∈ ℰ for 𝑖 = 1, … , 𝑙 − 1
E.g.:
 (1,2,4,3,5) is a path
 (1,2,3,4,2,3,5):
 not a path
 (1,5,3):
 not a path

5-5
Cycle
 A sequence of nodes 𝑛1 , 𝑛2 , … , 𝑛𝑙 , 𝑛1 from 𝒩
such that 𝑛1 , 𝑛2 , … , 𝑛𝑙 are distinct and
(𝑛1 , 𝑛2 ), … , 𝑛𝑙−1 , 𝑛𝑙 , (𝑛𝑙 , 𝑛1 ) ∈ ℰ
E.g.:
 (1,2,4,3,1) and (1,2,3,1) are cycles
 (1,2,4,3,2,4,3,1) not a cycle

5-6
Connected Graph
 A graph G = (𝒩, ℰ) is connected if there
exists a path between every pair of
distinct nodes 𝑖, 𝑗 ∈ 𝒩
E.g.:
 Graph on previous slide connected
 Graph in figure below not connected

5-7
Lemma
 G = (𝒩, ℰ) is a connected graph
 𝒮: a non-empty proper subset of 𝒩
 Then ∃ (𝑖, 𝑗) ∈ ℰ such that 𝑖 ∈ 𝒮, 𝑗 ∈ 𝒩\𝒮

5-8
 G = (𝒩, ℰ): a given graph
Sub-Graph
 G′ = (𝒩 ′ , ℰ ′ ) is a sub-graph of G if:
 𝒩 ′ ⊆ 𝒩, ℰ ′ ⊆ ℰ, and
 G′ is itself a graph

E.g.: G is graph in figure


 𝒩 ′ = {1,2,4}, ℰ ′ = { 1,2 , 2,4 }:
 is a sub-graph
 𝒩 ′ = {1,2,3,5}, ℰ ′ = 1,2 , 3,5 :
 is a sub-graph

 𝒩 ′ = {1,2}, ℰ ′ = 3,5 :
 not a sub-graph

5-9
Tree
 A connected graph with no cycles
E.g.:
 Graph in fig (a) is tree
 Graphs in figs. (b) and (c) not trees

(c)
(a) (b) 5-10
Property 1
 A tree with 𝑁 nodes has exactly 𝑁 − 1
edges
 Proof

5-11
Property 2
 Between any two nodes 𝑖 and 𝑗 in a tree,
there is exactly one path
 Proof

5-12
Property 3
 G = (𝒩, ℰ): a given tree
 𝑖, 𝑗 ∈ 𝒩 such that (𝑖, 𝑗) ∉ ℰ
 If we add an edge between nodes 𝑖 and 𝑗,
then exactly one cycle is formed
 Proof

5-13
Sub-Tree
 G = (𝒩, ℰ): a given graph
 G′ = (𝒩 ′ , ℰ ′ ) is a sub-tree of G if it is a sub-graph
of G and is a tree
 E.g.: graph in fig (b) is sub-tree of graph in fig (a)

(a) (b) 5-14


Spanning Tree
 G′ = (𝒩 ′ , ℰ ′ ) is a spanning tree of G=(𝒩, ℰ)
if it is a sub-tree of G and 𝒩 ′ = 𝒩

5-15
Finding Spanning Tree of a Given
Connected Graph
Lemma: If G = (𝒩, ℰ) is a connected graph, then
it has a spanning tree
Procedure for Finding a Spanning Tree:
1

5
2
3

4
Procedure for Finding A Spanning Tree of
a Given Connected Graph
1) 𝒩 ′ = {𝑢}, ℰ ′ = {∅}, where 𝑢 ∈ 𝒩 is arbitrary
2) Select an edge (𝑖, 𝑗) such that 𝑖 ∈ 𝒩 ′ , 𝑗 ∈ 𝒩\𝒩 ′
3) Add 𝑗 to 𝒩 ′ and (𝑖, 𝑗) to ℰ ′
o Repeat (2) and (3) until 𝒩 ′ = 𝒩
❑ Claim:
▪ There always exists an edge (𝑖, 𝑗) in step (2)
▪ (𝒩 ′ , ℰ ′ ) is a sub-tree at each iteration

5-17
Lemma

 Let G = (𝒩, ℰ) be a connected graph,


N = |𝒩| and E = ℰ
 Then:
a) 𝐸 ≥𝑁−1
b) G is a tree iff 𝐸 = 𝑁 − 1

5-18

You might also like