0% found this document useful (0 votes)
26 views32 pages

_THG_Chapter_1 Basics of Graph Theory - Part 1

Uploaded by

Amel Bt
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views32 pages

_THG_Chapter_1 Basics of Graph Theory - Part 1

Uploaded by

Amel Bt
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 32

Democratic and Popular Republic of Algeria

Ministry of Higher Education and Scientific Research


Mila University
Institute of Mathematics and Computer Science - Computer Science
Department
2nd Year Computer Science - Semester 3

Théorie des Graphes

Module Supervisor:
Mr Merabet Adil
Email : [email protected]
https://elearning.centre-univ-mila.dz/a2024/
course/view.php?id=331
Basics of Graph Theory

I. Introduction

 Graph theory is a vast field, constantly evolving.


 This theory allows us to represent a complex set of objects by expressing
the relationships between the elements.

the relationship
Object 1 Object 2
Basics of Graph Theory

I. Introduction
Graphs (and therefore graph theory) are used in many fields.
Some examples:
 Data transport networks :
 fixed telephone network,
 GSM,
 3G, 4G
 wi-fi ..
Basics of Graph Theory

I. Introduction
Graphs (and therefore graph theory) are used in many fields.
Some examples:
 Data transport networks :
 Road transport networks,
Basics of Graph Theory

I. Introduction
Graphs (and therefore graph theory) are used in many fields.
Some examples:
 Data transport networks :
 Road transport networks,
 Electronic circuits,
Basics of Graph Theory

Example 1: The road transport problem


How can we get from city A to a city G as quickly as possible? Knowing the
duration of the following trips:
 Users take 4 hours to travel from city A to city N.
 It takes users 9 hours to travel from city A to city M.
 It takes users 12 hours to travel from city A to city L.
 Traveling from city M to city G takes users 4 hours 30 minutes.
 It takes users 4 hours and 30 minutes to travel from City C to City G.
 Users take 1 hour and 15 minutes to travel from city L to city G.
 Traveling from city M to city L takes users 2 hours and 30 minutes.
 Users take 2 hours to travel from city N to city D.
 It takes users 7 hours to travel from city N to city L.
 Users take 1 hour to travel from city D to city C.
Basics of Graph Theory

Example 1: The road transport problem


How do you get from city A to city G as quickly as possible?

It is easier to explain the problem using a graph,


A good picture is worth a thousand words (Un bon dessin vaut mieux qu’un bon discours)
Basics of Graph Theory

Example 2: The Königsberg bridge problem (Euler)


The question is: Can someone follow a route such that he crosses each bridge
once and only once?
Basics of Graph Theory

Example 2 : The Königsberg bridge problem (Euler)


The question is : Can someone follow a route such that he crosses each bridge
once and only once?
Basics of Graph Theory

Graphs therefore constitute a way of thinking.


which makes it possible to model and solve a wide variety of problems.
Basics of Graph Theory

Solutions to some problems:


Basics of Graph Theory

Solutions to some problems:


Basics of Graph Theory

Solutions to some problems:


Basics of Graph Theory

Solutions to some problems:


Basics of Graph Theory

Basic concepts and definitions


Basics of Graph Theory
II. Basic concepts
1. Definitions

a graph is formed by:


 vertices and,
 edges connecting the vertices.
Basics of Graph Theory
II. Basic concepts
1. Definitions

Mathematically,
a graph is a pair of sets (V, E), where V is the set of vertices and E is the set of
edges, formed by pairs of vertices.
G = ( X ; U ) where
 X = { x 1 , x 2 , x 3 , … , x n } is the set of vertices

 U = { u 1 , u 2 , u 3 , … , u m } is the set of arcs.


Basics of Graph Theory
II. Basic concepts
1. Definitions

A graph contains two types of information:


 The information given by the summits.
 The information given by the edges between the vertices.
Basics of Graph Theory
II. Basic concepts
Mathematically Representation Graphic Representation
Basics of Graph Theory
II. Basic concepts
2. Arcs and Edges

u1 in a graph is a pair u1 = ( x1, x2 )


 u1 is an edge, if x1 is related to x2 and x2 is related to x1 . The order of x1 and

x2 is not important in the couple ( x1, x2 ). Thus, ( x1, x2 ) = ( x2, x1 )

 u1 is an arc (oriented edge), if an object x1 can be in relation with x2 without x2

necessarily being in relation with x1 . The order of x1 and x2 is important in the

couple ( x1, x2 ). Thus, ( x1, x2 ) ≠ ( x2, x1 )


Basics of Graph Theory
II. Basic concepts
2. Arcs and Edges
 An edge can always be transformed into arcs

 For an arc u = ( x1, x2 ), x1 is the initial vertex end, x2 the terminal vertex (or

origin and destination). The arc u starts from x1 and arrives at x2


 A loop is an arc whose : initial vertex is equal to its terminal vertex . For
example: ( x , x ) is a loop.
Basics of Graph Theory
II. Basic concepts
3. Directed Graph and Undirected Graph :
Basics of Graph Theory
III. Representations of a graph

 The adjacency matrix


 The incidence matrix
 The adjacency list
Basics of Graph Theory
III. Representations of a graph
1. The adjacency matrix
 It is an n ⸼ n matrix D = (di,j), where n is the number of vertices, n = |X|

di,j = number of edges between vi and vj


(Each row and column of the matrix represents a vertex)
 The matrix D is symmetric, i.e.
 Memory space used: n 2
Basics of Graph Theory
III. Representations of a graph
1. The adjacency matrix
 The adjacency matrix of a directed graph G is D = (di,j),

where di,j = number of arcs that come out of vertex vi and go into vertex vj
Basics of Graph Theory
III. Representations of a graph
2. The incidence matrix
 It is an n × m matrix A = (ai,j), where n is the number of vertices and m is the

number of edges. Where:


 Memory space used: n × m,
Basics of Graph Theory
III. Representations of a graph
2. The incidence matrix
The adjacency matrix of a directed graph G is A = (ai,j),
Where:
Basics of Graph Theory
III. Representations of a graph
3. The adjacency list
 Each vertex is associated with a list of its adjacent vertices, it is a list of lists or
an array of lists.
 Each cell i pointing to the linked list of neighbors

 It is significantly more efficient in terms of memory occupied than the


previous representations (we only code the arcs actually present in the graph).
 Easy to add or remove vertices and edges,
Basics of Graph Theory

We have the following terminologies:


1. The two vertices u and v are end vertices of the edge (u, v)
2. Edges that have the same end vertices are parallel.
3. An edge of the form (v, v) is a loop.
4. A graph with no edges (i.e. E is empty) is empty.
5. A graph with no vetices (i.e. V and E are empty) is a null graph.
6. A graph with only one vertex is trivial.
7. A that contains every possible edge between all the vertices is called a
complete graph. A complete graph with n vertices is denoted as Kn
Basics of Graph Theory

We have the following terminologies:


8. Edges are adjacent if they share a common end vertex.

9. Two vertices and are adjacent if they are connected by an edge

10. The order of a graph is the number of vertices in that graph.


Basics of Graph Theory

We have the following terminologies:

11. The degree of a vertex v, d(v), is the number of edges with v as an end vertex.
(by convention, we count a loop twice and parallel edges contribute separately)
12. The degree of a vertex v in a directed graph,
d(v) = d+ (v) + d- (v)
d+ (v) : Out-degree: (the number of edges that point from the vertex v).
d- (v) : In-degree (the number of edges that point to the vertex v)

Example:
d+( x2 ) = 2, d-( x2 ) = 1, d ( x2 ) = 3
d+( x5 ) = 2, d-( x5 ) = 3, d ( x5 ) = 5
Basics of Graph Theory

We have the following terminologies:


13. A pendant vertex is a vertex whose degree is 1.
14. An edge that has a pendant vertex as an end vertex is a pendant edge.
15. An isolated vertex is a vertex whose degree is 0
16. The degree of a graph is the maximum degree of all its vertices.
17. A graph is simple if it has no parallel edges or loops.
18. In contrast to a simple graph, a multigraph is a graph that allows multiple
edges between the same pair of vertices, or contains loops.

You might also like