0% found this document useful (0 votes)
58 views

Week 2 Graph Theory

graph theory

Uploaded by

aalijahriaz
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)
58 views

Week 2 Graph Theory

graph theory

Uploaded by

aalijahriaz
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/ 44

Graph Theory

Discrete Mathematics

MAHAM NOOR
Introduction
A graph is a set of points, called nodes or vertices, which are interconnected
by a set of lines called edges. The study of graphs, or graph theory is an
important part of a number of disciplines in the fields of mathematics,
engineering and computer science
What is a Graph?

Definition − A graph (denoted as G=(V,E) ) consists of a non-empty set of vertices or nodes V


and a set of edges E.
Example − Let us consider, a Graph is G=(V,E)
where V={a,b,c,d}
and E={{a,b},{a,c},{b,c},{c,d}}
Degree of a Vertex
The degree of a vertex V of a graph G (denoted by deg (V)) is the number of
edges incident with the vertex V.
Even and Odd Vertex

If the degree of a vertex is even, the vertex is called an even vertex and if
the degree of a vertex is odd, the vertex is called an odd vertex.
Degree of a Graph −

The degree of a graph is the largest vertex degree of that graph. For the
above graph the degree of the graph is 3.
The Handshaking Lemma −

In a graph, the sum of all the degrees of all the vertices is equal to twice the
number of edges.
There are different types of graphs, which we will
learn in the following section.
Types of
Graphs
Null Graph

A null graph has no edges. The null graph of nn vertices is denoted by Nn


Simple Graph
A graph is called simple graph/strict graph if the graph is undirected and
does not contain any loops or multiple edges.
Multi Graph
If in a graph multiple edges between the same set of vertices are allowed, it
is called Multigraph. In other words, it is a graph having at least one loop or
multiple edges.
Directed or Undirected Graph
A graph G=(V,E) is called a directed graph if the edge set
is made of ordered vertex pair and a graph is called undirected
if the edge set is made of unordered vertex pair.
Connected or Disconnected
Graph
A graph is connected if any two vertices of the
graph are connected by a path; while a graph is
disconnected if at least two vertices of the graph
are not connected by a path. If a graph G is
disconnected, then every maximal connected
subgraph of G is called a connected component
of the graph G
.
Regular graph
A graph is regular if all the vertices of the graph have the same degree. In a regular graph G of
degree r, the degree of each vertex of G is r.
Complete Graph
A graph is called complete graph if every two vertices pair are joined by exactly one edge. The
complete graph with n vertices is denoted by Kn
Cycle Graph
If a graph consists of a single cycle, it is called cycle graph. The cycle graph with n vertices is
denoted by Cn
Bipartite Graph
If the vertex-set of a graph G can be split into two disjoint sets, V1
and V2 , in such a way that each edge in the graph joins a vertex in V1
to a vertex in V2 , and there are no edges in G that connect two vertices in V1
or two vertices in V2 , then the graph G is called a bipartite graph.
Complete Bipartite Graph
A complete bipartite graph is a
bipartite graph in which each vertex in
the first set is joined to every single
vertex in the second set. The complete
bipartite graph is denoted by Kx,y
where the graph G contains x vertices
in the first set and y vertices in the
second set.
Planar Vs non planar graph
Planar Graph: A graph G is called a planar graph if it can be drawn in a plane without any edges
crossed. If we draw graph in the plane without edge crossing, it is called embedding the graph in
the plane.
Non-planar graph −
A graph is non-planar if it cannot be drawn in a plane without graph edges
crossing.
Isomorphism
If two graphs G and H contain the same number of vertices connected in the same way, they are
called isomorphic graphs (denoted by G≅H).
It is easier to check non-isomorphism than isomorphism. If any of these following conditions
occurs, then two graphs are non-isomorphic −
1. The number of connected components are different
2. Vertex-set cardinalities are different
3. Edge-set cardinalities are different
4. Degree sequences are different
Example
The following graphs are isomorphic −
Euler Graph
A connected graph G is called an Euler graph, if there is a closed trail which includes every edge
of the graph G. An Euler path is a path that uses every edge of a graph exactly once. An Euler
path starts and ends at different vertices. An Euler circuit is a circuit that uses every edge of a
graph exactly once. An Euler circuit always starts and ends at the same vertex. A connected
graph G is an Euler graph if and only if all vertices of G are of even degree, and a connected
graph G is Eulerian if and only if its edge set can be decomposed into cycles.

The left graph is an


Euler graph as
“a1b2c3d4e5c6f7g”
covers all the edges
of the graph.
Hamiltonian Graphs
Hamiltonian Graphs
Some more examples
There are mainly two ways to represent a graph
Representation of
Graphs 1. Adjacency Matrix
2. Adjacency List

1. Adjacency Matrix

2. Adjacency List
Adjacency Matrix
An Adjacency Matrix A[V][V] is a 2D array of size V×V where V is the number of vertices in a
undirected graph. If there is an edge between Vx to Vy then the value of A[Vx][Vy]=1 and A[Vy]
[Vx]=1, otherwise the value will be zero. And for a directed graph, if there is an edge between Vx to
Vy, then the value of A[Vx][Vy]=1 , otherwise the value will be zero.
Adjacency Matrix of an
Undirected Graph
Let us consider the following undirected graph and construct the adjacency
matrix −
Adjacency Matrix of a
Directed Graph
Let us consider the following directed graph and construct its adjacency
matrix −
Adjacency List
In adjacency list, an array (A[V]) of linked lists is used to represent the graph G with V number of
vertices. An entry A[Vx] represents the linked list of vertices adjacent to the Vx−th vertex. The
adjacency list of the undirected graph is as shown in the figure below −
Many problems can be modeled using graphs with
Shortest Path weights assigned to their edges. How an airline
system can be modeled. We set up the basic graph
problem model by representing cities by vertices and flights
Dijkstra algorithm
by edges.  Problems involving distances can be
modeled by assigning distances between the cities
to the edge.  Problems involving flight time can be
modeled by assigning flight times to edges. 
Problems involving fares can be modeled by
assigning fares to the edges.
Weighted Graphs Modeling an
Airline System
Problems involving distances can be modeled by assigning distances between the cities to the
edge.
Weighted Graphs Modeling an
Airline System
Problems involving distances can be modeled by assigning distances between the cities to the
edge.
Weighted Graphs Modeling an
Airline System
Problems involving distances can be modeled by assigning distances between the cities to the
edge.
Dijkstra’s Algorithm
Dijkstra’s Algorithm
Dijkstra’s Algorithm
Dijkstra’s Algorithm
Dijkstra’s Algorithm
Dijkstra’s Algorithm
Dijkstra’s Algorithm
Dijkstra’s Algorithm
Happy Learning
Maham Noor

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy