You are on page 1of 17

Introduction to Graph Theory

Vertices and Edges: “Networks”


Important in Computer Science, Electrical Eng., Social Sciences…

part of
Data Structures
Discrete Mathematics, Graphs and Algorithm
s,
part of: Combinatorics
Prof. Hassane Bouzahir
(Just google my name)

1 ENSA Agadir, 2014


1. Graphs
Graph
A graph G = (V, E, γ) consists of a finite set V of o
bjects called vertices, a finite set E of objects called
edges, and a function γ that assigns to each edge a
subset {v, w}, where v and w are vertices (and may b
e the same).

End points
If γ(e) = {v, w}, then vertices v and w are called the
end points of e.

2 ENSA Agadir, 2014


1. Graphs
Example 1 & 2
Let V = {1, 2, 3, 4} and E = {e1, e2, e3, e4, e5}. Let γ
be defined by γ(e1) = γ(e5) = {1, 2}, γ(e2) = {4, 3}, γ(e
3) = {1, 3}, γ(e4) = {2, 4} .
Then G = (V, E, γ) is a graph.
Isomorphic Graphs

1 2 1 2

1 2 3 4
4 3 3 4
G G G

3 ENSA Agadir, 2014


1. Graphs
Degree. The degree of a vertex is the number of edg
es having that vertex as an end point.
To be precise: the degree of a vertex is the number
of endpoints on that vertex, i. e., if an edge is from a v
ertex to itself, we count it two times.
Loop. An edge is referred to as a loop if the edge is f
rom a vertex to itself.
Note: a loop contributes 2 to the degree of a vertex,
since that vertex serves as both end points of the loo
p.
Isolated. A vertex with degree 0 is called an isolated
vertex.

4 ENSA Agadir, 2014


1. Graphs
Example 3
p
a b
A B
q 2
s 5
r C c 3 4
E
t
u 1 6
d e
D

A: 2 B: 4 a: 4 b: 2 All edges with


C: 1 D: 3 E: 2 c: 3 d: 1 e: 0 degree 2

5 ENSA Agadir, 2014


1. Graphs
Path in a Graph
A path п in a graph G consists of a pair (Vп, Eп) of
sequences: a vertex sequence Vп : v1, v2, …, vk and
an edge sequence E п : e1, e2,…,ek-1 for which
1. Each successive pair vi, vi+1 of vertices is adjacent i
n G, and edge ei has vi and vi+1 as end points for i=
1, …, k-1;

2. No edge occurs more than once in the edge sequen


ce.

6 ENSA Agadir, 2014


1. Graphs
Circuit (cycle)
A circuit is a path that begins and ends at the sa
me vertex.

Simple
A path is called simple if no vertex appears more t
han once in the vertex sequence, except possibly
if v1= vk. In this case, the path is called a simple ci
rcuit.

7 ENSA Agadir, 2014


1. Graphs
Connected, Disconnected & Components
A graph is called connected if there is a path from any
vertex to any other vertex in the graph. Otherwise, the gr
aph is disconnected. If the graph is disconnected, the var
ious connected pieces are called the components of the
graph.
p 2 5

A B 3 4
q
s
r C 1 6
E Connected Disconnected
t Two components
u
D
8 ENSA Agadir, 2014
1. Graphs
Some important special families of graphs w
ill be useful in our discussions.
1.Un (discrete graph) denote the graph with n vertic
es and no edges.

U2 U5
2.Ln (linear graph) denote the graph with n vertices
and with edges {vi,vi+1} for 1≤ i <n

L2 L5

9 ENSA Agadir, 2014


1. Graphs
3. Kn (complete graph) denote the graph with n verti
ces and with an edge {vi, vj } for all i and j.

K2=L2
K3 K4
Regular K5
If each vertex of a graph has the same degree as
every other vertex, the graph is called regular, e.
g., Kn (n=2, 3, 4, 5) above.

10 ENSA Agadir, 2014


1. Graphs
Subgraph
Suppose that G = (V, E, γ) is a graph. Choose a s
ubset E1 of the edges in E and a subset V1 of the ver
tices in V, so that V1 contains (at least) all the end po
ints of edges in E1. Then H = (V1, E1, γ1) is also a gra
ph where γ1 is γ restricted to edges in E1. Such a gra
ph H is called a subgraph of G.

11 ENSA Agadir, 2014


1. Graphs
The subgraph Ge
Deleting one edge and no vertices

a b a b

i f i f
h g h g

d c d Ge c
G

e = {a, b}

12 ENSA Agadir, 2014


1. Graphs
Example 8 b

i f i f
h g h g
a b
d c d c
i f
a b
h g

d c i f
G h g

d c

13 ENSA Agadir, 2014


1. Graphs
Example 9 (Quotient graph GR)
Let G be the graph (without multiple edges) of the follo
wing figure, and let R be the equivalence relation on V d
efined by the partition.
{{a, m, i}, {b, f, j}, {c, g, k}, {d, h, l}}

a b

m f [a] [b] [m] [j]


i
l
j
k =
[d] [c] [h] [k]
h g
GR GR
d c
14 ENSA Agadir, 2014
1. Graphs
Example 9
If S is also an equivalence relation on V defined by the
partition.
{{i, j, k, l}, {a, m}, {f, b, c}, {d}, {g}, {h}}
[a] [b]
a b

m f [i]
i j
l k
[h] [g]
h g

d c [d] GS

15 ENSA Agadir, 2014


1. Graphs
The Quotient graph Ge
If e is an edge between vertex v and w in a graph G =
{V, E, γ}, then we consider the equivalence relation whos
e partition consists of {v, w} and {vi}, for each vi  v, vi 
w. (merging v and w and leaving others alone)
a b a b
m f m f
i j [i]
l k l
k
h g g
h

d c d c
G Ge
e = {i, j}
16 ENSA Agadir, 2014
1. Graphs
Homework
Ex. 6, Ex. 16, Ex. 20, Ex. 22, Ex. 23, Ex. 29

17 ENSA Agadir, 2014

You might also like