Graph
β’ graph is a pair (π, πΈ) of two sets where
β π = set of elements called vertices (singl. vertex)
β πΈ = set of pairs of vertices (elements of π) called edges
β’ Example: πΊ = (π, πΈ) where
π = * 1, 2, 3, 4 +
πΈ = * *1, 2+, *1, 3+,
*2, 3+, *3, 4+ +
1
3
4
2
drawing of πΊ
β’ Notation:
β we write πΊ = (π, πΈ) for a graph with vertex set π and edge set πΈ
β π(πΊ) is the vertex set of πΊ, and πΈ(πΊ) is the edge set of πΊ
Types of graphs
β’ Undirected graph
1
πΈ = **1,2+, *1,3+,
*2,3+, *3,4++
3
2
4
1
1
2
1
3
1
2
3
1
1
4
1
1
4
1
1
1
1
1
2
3
1
1
2
3
4
1
1
1
4
(IRREFLEXIVE) RELATION
πΈ(πΊ) = set of ordered pairs
β’ Multigraph
β’ Pseudograph (allows loops)
SYMMETRIC
1
2
πΈ(πΊ) = set of unordered pairs
2
πΈ = *(1,2), (2,3),
(1,3), (3,1),
(3,4)+
3
4
1
SYMMETRIC & IRREFLEXIVE
πΈ = **1,2+, *1,3+, *2,2+,
*2,3+, *3,3+,
1
*3,4++
3
4
β’ Directed graph
2
3
1
1
2
1
1
1
3
1
1
1
4
0
4
1
3
1
1
loop = edge between vertex and itself
πΈ = **1,2+, *1,3+, *1,3+, *1,3+, 2,3 ,
2,3 , *3,4+, *3,4+, *3,4+, *3,4++
2
4
?
πΈ(πΊ) is a multiset
1
1
2
1
3
3
4
2
3
1
3
4
2
2
4
4
More graph terminology
β’ simple graph (undirected, no loops, no parallel edges)
for edge *π’, π£+οπΈ(πΊ) we say:
1 is adjacent to 2 and 3
β π’ and π£ are adjacent
1
N(1) = *2,3+
β π’ and π£ are neighbours
3
4
N(2) = *1,3+
2
β π’ and π£ are endpoints of *π’, π£+
N(3) = *1,2,4+
deg(3) = 3
N(4) = *3+
β we write π’π£οπΈ πΊ for simplicity
deg 4 = 1
deg(1) = deg(2) = 2
β’ N(π£) = set of neighbours of π£ in G
β’ deg(π£) = degree of v is the number of its neighbours, ie. |N(π£)|
1
3
2
=
β
1
1
3
2
3
2
β
1
3
2
π(1) = 2
π(2) = 3
π(3) = 1
πΊ1 = (π1 , πΈ1 ) is isomorphic to πΊ2 = (π2 , πΈ2 ) if there exists a bijective
mapping π: π1 β π2 such that π’π£οπΈ(πΊ1 ) if and only if π π’ π(π£)οπΈ(πΊ2 )
Isomorphism
3
3
3
1
2
3
2
4
4
6
β
5
6
3
3
3
(3,3,3,3,3,3)
degree sequence
2
β
1
4
3
5
3
5
(3,3,3,3,3,3)
if π is an isomorphism
ο deg(π’) = deg(π(π’))
6
1
(3,3,3,3,3,3)
β
i.e., isomorphic graphs have
same degree sequences
only necessary not sufficient!!!
(3,3,3,3,2,2,2,2)
(3,3,3,3,2,2,2,2)
Isomorphism
How many pairwise non-isomorphic graphs on π vertices are there?
1
1
3
3
2
2
1
1
1
3
3
2
1
3
2
1
1
3
2
2
3
3
2
2
all graphs
(labeled)
non-isomorphic graphs
(without labels)
the complement of πΊ = (π, πΈ) is the graph πΊ = (π, πΈ ) where
πΈ = π’, π£ *π’, π£+οπΈ+
3
3
πΈ(πΊ) = **1,2+, *2,3+, *3,4+, *4,5++
2
4
2
4
πΈ(πΊ ) = **1,3+, *1,4+, *1,5+, *2,4+,
*2,5+, *3,5++
1
5
1
5
πΊ
πΊ
Isomorphism
How many pairwise non-isomorphic graphs on π vertices are there?
β
self-complementary graph
Isomorphism
β’ Are there self complementary graphs on 5 vertices ?
3
3
1 β 1, 2 β 4, 3 β 2
4 β 5, 5 β 3
2
4
2
4
β’ ... 6 vertices ?
1
5
1
5
1 β 2, 2 β 5, 3 β 3
4 β 1, 5 β 4
No, because in a self-complementary graph πΊ = (π, πΈ)
|π|
|πΈ| = |πΈ | and πΈ + πΈ =
1
2
6
but
= 15 is odd
5
2
7
No,
since
= 21
β’ ... 7 vertices ?
8
2
β’ ... 8 vertices ?
Yes, there are 10
1 β 4, 2 β 6, 3 β 1, 4 β 7
5 β 2, 6 β 8, 7 β 3, 8 β 5
Yes, 2
4
2
6
7
3
deg(1) = 2
deg(2) = 2
deg(3) = 3
deg 4 = 1
Handshake lemma
Lemma. Let πΊ = (π, πΈ) be a graph with π edges.
deg π£ = 2π
1
3
2
4
π=4
π£βπ
Proof. Every edge *π’, π£+ connects 2 vertices and contributes to
exactly 1 to deg(π’) and exactly 1 to deg(π£). In other words, in
π£βπ deg(π£) every edge is counted twice. οΏ
2
How many edges has a graph with degree sequence:
- (3,3,3,3,3,3) ?
- (3,3,3,3,3) ?
- (0,1,2,3) ?
4
6
1
3
5
Corollary. In any graph, the number of vertices of odd degree is even.
Corollary 2. Every graph with at least 2 vertices has 2 vertices of the same degree.
Handshake lemma
Is it possible for a self-complementary graph with 100
vertices to have exactly one vertex of degree 50 ?
πΊ
Answer. No
π isomorphism
between πΊ and πΊ
N(π’)
π’
π£ is a unique vertex
of degree 49 in πΊ
the degree seq. of πΊ and πΊ
(β¦ , β¦ , β¦ , 50,49, β¦ , β¦ , β¦ )
π’π£ β πΈ(πΊ) ο π(π’)π(π£) β πΈ(πΊ )
definition of isomorphism
βπ£, π(π£) = π’
π’
50
π£
πΊ
π(πΊ)\N(π’)
49
we conclude π(π’) = π£
but π(π’)π(π£) = π£π’ β πΈ(πΊ ) ο π’π£ β πΈ(πΊ)
definition of complement
NπΊ (π’)
49
οΏ
Subgraphs
Let πΊ = (π, πΈ) be a graph
β’ a subgraph of πΊ is a graph πΊβ² = (πβ², πΈβ²) where π β² ο π and πΈ β² ο πΈ
β’ an induced subgraph (a subgraph induced on π΄ο π) is a graph
πΊ,π΄- = (π΄, πΈπ΄ ) where πΈπ΄ = πΈ β© π΄ × π΄
1
1
3
2
4
3
2
4
3
4
2
subgraph
induced subgraph
on π΄ = *2,3,4+
Walks, Paths and Cycles
Let πΊ = (π, πΈ) be a graph
β’ a walk (of length π) in πΊ is a sequence
π£1 , π1 , π£2 , π2, β¦ , π£πβ1 , ππβ1 , π£π
where π£1 , β¦ , π£π β π and ππ = *π£π , π£π+1 + β πΈ for all π β *1. . π β 1+
β’ a path in πΊ is a walk where π£1 , β¦ , π£π are distinct
(does not go through the same vertex twice)
β’ a closed walk in πΊ is a walk with π£1 = π£π
(starts and ends in the same vertex)
β’ a cycle in πΊ is a closed walk where π ο³ 3 and π£1 , β¦ , π£πβ1 are distinct
1
3
2
4
1,{1,2},2,{2,1},1,{1,3},3
is a walk (not path)
1,{1,2},2,{2,3},3,{3,1},1
is a cycle
Special graphs
β’
β’
β’
β’
1
2
ππ path on π vertices
πΆπ cycle on π vertices
πΎπ complete graph on π vertices
π΅π hypercube of dimension π
π π΅π = 0,1
5
π5
2
4
πΆ5
1
5
3
4
3
π
3
(π1 , β¦ , ππ ) adjacent to π1 , β¦ , ππ
if ππ βs and ππ βs differ in exactly once
2
4
1
5
πΎ5
π
π=1
(0,1,0,0) adjacent to (0,1,0,1)
not adjacent to (0,1,1,1)
111
110
ππ β ππ = 1
100
000
010
101
001
011
π΅3
Connectivity
β’ a graph πΊ is connected if for any two vertices π’, π£ of πΊ
there exists a path (walk) in πΊ starting in π’ and ending in π£
1
1,{1,3},3,{3,4},4
path from 1 to 4
3
2
connected components
1
4
3
4
no path
from 1 to 4
2
connected
not connected = disconnected
β’ a connected component of πΊ is a maximal connected
subgraph of πΊ
Connectivity
β’ Show that the complement of a disconnected graph is connected !
π’
π’
π’
π£
π£
π€
πΊ
π€
πΊ
πΊ
β’ What is the maximum number of edges in a disconnected graph ?
π
2
πβπ
2
max
π
πβ1
π
πβπ
+
=
2
2
2
maximum when π = 1
β’ What is the minimum number of edges in a connected graph ?
1
2
3
4
5
path ππ on π vertices has π β 1 edges
cannot be less, why ? keep removing edges
so long as you keep the graph connected
ο a (spanning) tree which has π β 1 edges
Distance, Diameter and Radius
recall walk (path) is a sequence of vertices and edges
π£1 , π1 , π£2 , π2, β¦ , π£πβ1 , ππβ1 , π£π
if edges are clear from context we write π£1 , π£2 , β¦ , π£π
β’ length of a walk (path) is the number of edges
β’ distance π(π’, π£) from a vertex π’ to a vertex π£ is the length of
a shortest path in πΊ between π’ and π£
2
3
4
π(π’, π£) 1
β’ if no path exists define π π’, π£ = β
1
3
2
4
π(1,2) = 1
π(1,4) = 2
matrix
of distances in πΊ
distance matrix
1
0
1
1
2
2
1
0
1
2
3
1
1
0
1
4
2
2
1
0
Distance, Diameter and Radius
β’ eccentricity of a vertex π’ is the largest distance between π’
and any other vertex of πΊ; we write πππ π’ = max π(π’, π£)
π£
β’ diameter of πΊ is the largest distance between two vertices
ππππ πΊ = max π π’, π£ = max πππ(π£)
π’,π£
π£
β’ radius of πΊ is the minimum eccentricity of a vertex of πΊ
πππ πΊ = min πππ(π£)
πππ(πΊ) = 1
(as witnessed by 3
called a centre)
π£
1
3
2
4
ππππ(πΊ) = 2
(as witnessed by 1,4
called a diametrical pair)
πππ(1) = 2
πππ(2) = 2
πππ(3) = 1
πππ(4) = 2
Find radius and diameter of graphs ππ , πΆπ , πΎπ , π΅π
Prove that πππ(πΊ) β€ ππππ(πΊ) β€ 2 β πππ(πΊ)
Independent set and Clique
β’
β’
β’
β’
clique = set of pairwise adjacent vertices
independent set = set of pairwise non-adjacent vertices
clique number π(πΊ) = size of largest clique in πΊ
independence number πΌ(πΊ) = size of largest independent set in πΊ
*1,2,3+ is a clique
1
3
2
πΌ πΊ =2
π πΊ =3
4
*1,4+ is an independent set
Find πΌ(ππ ), πΌ(πΆπ ), πΌ πΎπ , πΌ(π΅π )
π(ππ ), π(πΆπ ), π(πΎπ ), π(π΅π )
1
2
3
π5
4
5
Bipartite graph
β’ a graph is bipartite if its vertex set π can be partitioned
into two independent sets π1 , π2 ; i.e., π1 βͺ π2 = π
1
1
3
3
4
4
2
2
bipartite
1
2
π1
π2
4
3
not bipartite
1 β π1
1
3 β π2
3
2
2 β π2
4
but now π2 is not
an independent
set because
*2,3+ β πΈ(πΊ)
Bipartite graph
β’ a graph is bipartite if its vertex set π can be partitioned
into two independent sets π1 , π2 ; i.e., π1 βͺ π2 = π
πΎ1,2
Which of these
graphs are
bipartite:
ππ , πΆπ , πΎπ , π΅π ?
πΎ2,2
πΎ3,3
πΎπ,π = complete bipartite graph
πΎ
4,4
π πΎπ,π = *π1 β¦ ππ , π1 β¦ ππ +
πΈ πΎπ,π = ππ ππ π β 1. . π , π β 1. . π +
Bipartite graph
Theorem. A graph is bipartite ο it has no cycle of odd length.
Proof. Let πΊ = (π, πΈ). We may assume that πΊ is connected.
βοβ any cycle in a bipartite graph is of even length
3
2
4
2
1
3
3
1
2
1
4
5
2
1
3
6
4
5
3
2
4
π odd
1
5
π
βοβ Assume G has no odd-length cycle. Fix a vertex π’ and put it in π1 .
Then repeat as long as possible:
π’
- take any vertex in π1 and put its neighbours in π2 , or
- take any vertex in π2 and put its neighbours in π1 .
Afterwards π1 βͺ π2 = π because πΊ is connected.
If one of π1 or π2 is not an independent set, then
?
we find in πΊ an odd-length closed walk ο cycle, impossible.
So, πΊ is bipartite (as certified by the partition π1 βͺ π2 = π)
οΏ
© Copyright 2026 Paperzz