SlideShare a Scribd company logo
2
Most read
5
Most read
7
Most read
Graph Data Structure and
Algorithms
Presented by
D.Anandhasilambarasan
KIT - CBE
Graph Data Structure and Algorithms
A Graph is a non-linear data structure consisting of nodes and
edges.
The nodes are sometimes also referred to as vertices and the
edges are lines or arcs that connect any two nodes in the graph.
A Graph consists of a finite set of vertices (or nodes) and set of
Edges which connect a pair of nodes.
 Nodes: These are the most important components in any graph. Nodes are
entities whose relationships are expressed using edges. If a graph comprises
2 nodes A and B and an undirected edge between them, then it expresses a
bi-directional relationship between the nodes and edge.
 Edges: Edges are the components that are used to represent the relationships
between various nodes in a graph. An edge between two nodes expresses a
one-way or two-way relationship between the nodes.
- In the above Graph, the set of vertices V = {0,1,2,3,4}
and the set of edges E = {01, 12, 23, 34, 04, 14, 13}.
Types of graphs
Undirected: An undirected graph is a graph in which all the edges are bi-
directional
i.e. the edges do not point in any specific direction.
Directed: A directed graph is a graph in which all the edges are uni-directional
i.e. the edges point in a single direction.
Weighted: In a weighted graph, each edge is assigned a weight or cost.
Cyclic: A graph is cyclic if the graph comprises a path that starts from a vertex
and ends at the same vertex. That path is called a cycle. An acyclic graph is a
graph that has no cycle.
Graph Representation
You can represent a graph in many ways. The two most common ways of
representing a graph is as follows:
Adjacency matrix
Adjacency list
Adjacency matrix
An adjacency matrix is a VxV binary matrix A. Element Ai,j is 1 if there is an
edge from vertex i to vertex j else Ai,jis 0.
Note: A binary matrix is a matrix in which the cells can have only one of two
possible values - either a 0 or 1.
The adjacency matrix of the following graph is:
i/j: 1 2 3 4
1: 0 1 0 1
2: 1 0 1 0
3: 0 1 0 1
4: 1 0 1 0
Adjacency list
The other way to represent a graph is by using an adjacency list. An adjacency
list is an array A of separate lists. Each element of the array Ai is a list, which
contains all the vertices that are adjacent to vertex i.
1 2
34
Graph data structure and algorithms
Applications of Graphs
 Graphs are used to solve many real-life problems. Graphs are used to
represent networks.
 The networks may include paths in a city or telephone network or circuit
network.
 Graphs are also used in social networks like LinkedIn, Facebook.
 It is used to Document link graphs.
 Scene graphs: Such graphs are very important in the computer games
industry.
 Robot planning: Such graph plans are used in planning paths for
Autonomous vehicles.
 Neural networks
 For example, in Facebook, each person is represented with a vertex (or
node).
 Each node is a structure and contains information like person id, name,
gender, locale etc.

More Related Content

What's hot (20)

PPT
Spanning trees
Shareb Ismaeel
 
PPTX
Data structure - Graph
Madhu Bala
 
PPTX
heap Sort Algorithm
Lemia Algmri
 
PPTX
Graph in data structure
Abrish06
 
PPTX
Linked list
KalaivaniKS1
 
PPTX
Data Structures - Lecture 9 [Stack & Queue using Linked List]
Muhammad Hammad Waseem
 
PPTX
ER model to Relational model mapping
Shubham Saini
 
PPTX
linked list in data structure
shameen khan
 
PPTX
joins in database
Sultan Arshad
 
PPT
Abstract data types
Poojith Chowdhary
 
PPTX
Linked stacks and queues
Ramzi Alqrainy
 
PPTX
Shortest path algorithm
sana younas
 
PPT
Linked lists
SARITHA REDDY
 
PPTX
Polynomial reppresentation using Linkedlist-Application of LL.pptx
Albin562191
 
PPTX
Doubly Linked List
Ninad Mankar
 
PPTX
Abstract Data Types
karthikeyanC40
 
PPTX
Quick sort
Afaq Mansoor Khan
 
PPTX
Sparse matrix and its representation data structure
Vardhil Patel
 
PPTX
FUNCTION DEPENDENCY AND TYPES & EXAMPLE
Vraj Patel
 
PPTX
Insertion Sorting
FarihaHabib123
 
Spanning trees
Shareb Ismaeel
 
Data structure - Graph
Madhu Bala
 
heap Sort Algorithm
Lemia Algmri
 
Graph in data structure
Abrish06
 
Linked list
KalaivaniKS1
 
Data Structures - Lecture 9 [Stack & Queue using Linked List]
Muhammad Hammad Waseem
 
ER model to Relational model mapping
Shubham Saini
 
linked list in data structure
shameen khan
 
joins in database
Sultan Arshad
 
Abstract data types
Poojith Chowdhary
 
Linked stacks and queues
Ramzi Alqrainy
 
Shortest path algorithm
sana younas
 
Linked lists
SARITHA REDDY
 
Polynomial reppresentation using Linkedlist-Application of LL.pptx
Albin562191
 
Doubly Linked List
Ninad Mankar
 
Abstract Data Types
karthikeyanC40
 
Quick sort
Afaq Mansoor Khan
 
Sparse matrix and its representation data structure
Vardhil Patel
 
FUNCTION DEPENDENCY AND TYPES & EXAMPLE
Vraj Patel
 
Insertion Sorting
FarihaHabib123
 

Similar to Graph data structure and algorithms (20)

PDF
Graphs in datastructures
LikhithaGunturi
 
PDF
The Graph Abstract Data Type-DATA STRUCTURE.pdf
Archana Gopinath
 
PPTX
Graphs data structures
Jasleen Kaur (Chandigarh University)
 
PPTX
Data Structure and algorithms - Graph1.pptx
Kishor767966
 
PPTX
graphs presentation .pptx
ssuser800a48
 
PPT
Basics of graph
Khaled Sany
 
PPT
Lecture 5b graphs and hashing
Victor Palmar
 
PPTX
Unit II_Graph.pptxkgjrekjgiojtoiejhgnltegjte
pournima055
 
PDF
graph representation.pdf
amitbhachne
 
PPTX
Graph Basic In Data structure
Ikhlas Rahman
 
PPTX
Techniques for graph
SOWNDARYASUGCOMPUTER
 
PPTX
DATA STRUCTURES unit 4.pptx
ShivamKrPathak
 
PPT
Graphs in Data Structure
hafsa komal
 
PPTX
Lecture 14 data structures and algorithms
Aakash deep Singhal
 
PPTX
Graph theory ppt.pptx
saranyajey
 
PPTX
Chapter 6-DS(Introduction to Graph and its terminologies).pptx
nasalapurepallavi272
 
PDF
graphs in data structure for Btech students.pdf
soniasharmafdp
 
PPTX
UNIT IV NON LINEAR DATA STRUCTURES - GRAPH
VISWANATHAN R V
 
PPTX
UNIT IV NON LINEAR DATA STRUCTURES - GRAPH.pptx
kncetaruna
 
PPT
Chap 6 Graph.ppt
shashankbhadouria4
 
Graphs in datastructures
LikhithaGunturi
 
The Graph Abstract Data Type-DATA STRUCTURE.pdf
Archana Gopinath
 
Graphs data structures
Jasleen Kaur (Chandigarh University)
 
Data Structure and algorithms - Graph1.pptx
Kishor767966
 
graphs presentation .pptx
ssuser800a48
 
Basics of graph
Khaled Sany
 
Lecture 5b graphs and hashing
Victor Palmar
 
Unit II_Graph.pptxkgjrekjgiojtoiejhgnltegjte
pournima055
 
graph representation.pdf
amitbhachne
 
Graph Basic In Data structure
Ikhlas Rahman
 
Techniques for graph
SOWNDARYASUGCOMPUTER
 
DATA STRUCTURES unit 4.pptx
ShivamKrPathak
 
Graphs in Data Structure
hafsa komal
 
Lecture 14 data structures and algorithms
Aakash deep Singhal
 
Graph theory ppt.pptx
saranyajey
 
Chapter 6-DS(Introduction to Graph and its terminologies).pptx
nasalapurepallavi272
 
graphs in data structure for Btech students.pdf
soniasharmafdp
 
UNIT IV NON LINEAR DATA STRUCTURES - GRAPH
VISWANATHAN R V
 
UNIT IV NON LINEAR DATA STRUCTURES - GRAPH.pptx
kncetaruna
 
Chap 6 Graph.ppt
shashankbhadouria4
 
Ad

Recently uploaded (20)

PPTX
Growth and development and milestones, factors
BHUVANESHWARI BADIGER
 
PPTX
Unit 2 COMMERCIAL BANKING, Corporate banking.pptx
AnubalaSuresh1
 
PPTX
Stereochemistry-Optical Isomerism in organic compoundsptx
Tarannum Nadaf-Mansuri
 
PPTX
Universal immunization Programme (UIP).pptx
Vishal Chanalia
 
PPTX
How to Create Odoo JS Dialog_Popup in Odoo 18
Celine George
 
PPTX
How to Manage Large Scrollbar in Odoo 18 POS
Celine George
 
PPTX
How to Create a PDF Report in Odoo 18 - Odoo Slides
Celine George
 
PPT
Talk on Critical Theory, Part II, Philosophy of Social Sciences
Soraj Hongladarom
 
PPTX
How to Handle Salesperson Commision in Odoo 18 Sales
Celine George
 
PDF
Generative AI: it's STILL not a robot (CIJ Summer 2025)
Paul Bradshaw
 
PPTX
Identifying elements in the story. Arrange the events in the story
geraldineamahido2
 
PDF
Horarios de distribución de agua en julio
pegazohn1978
 
PDF
Aprendendo Arquitetura Framework Salesforce - Dia 03
Mauricio Alexandre Silva
 
PPTX
grade 5 lesson matatag ENGLISH 5_Q1_PPT_WEEK4.pptx
SireQuinn
 
PDF
Chapter-V-DED-Entrepreneurship: Institutions Facilitating Entrepreneurship
Dayanand Huded
 
PPTX
HUMAN RESOURCE MANAGEMENT: RECRUITMENT, SELECTION, PLACEMENT, DEPLOYMENT, TRA...
PRADEEP ABOTHU
 
PDF
0725.WHITEPAPER-UNIQUEWAYSOFPROTOTYPINGANDUXNOW.pdf
Thomas GIRARD, MA, CDP
 
PPTX
PPT-Q1-WK-3-ENGLISH Revised Matatag Grade 3.pptx
reijhongidayawan02
 
PPTX
QUARTER 1 WEEK 2 PLOT, POV AND CONFLICTS
KynaParas
 
PPTX
PPT-Q1-WEEK-3-SCIENCE-ERevised Matatag Grade 3.pptx
reijhongidayawan02
 
Growth and development and milestones, factors
BHUVANESHWARI BADIGER
 
Unit 2 COMMERCIAL BANKING, Corporate banking.pptx
AnubalaSuresh1
 
Stereochemistry-Optical Isomerism in organic compoundsptx
Tarannum Nadaf-Mansuri
 
Universal immunization Programme (UIP).pptx
Vishal Chanalia
 
How to Create Odoo JS Dialog_Popup in Odoo 18
Celine George
 
How to Manage Large Scrollbar in Odoo 18 POS
Celine George
 
How to Create a PDF Report in Odoo 18 - Odoo Slides
Celine George
 
Talk on Critical Theory, Part II, Philosophy of Social Sciences
Soraj Hongladarom
 
How to Handle Salesperson Commision in Odoo 18 Sales
Celine George
 
Generative AI: it's STILL not a robot (CIJ Summer 2025)
Paul Bradshaw
 
Identifying elements in the story. Arrange the events in the story
geraldineamahido2
 
Horarios de distribución de agua en julio
pegazohn1978
 
Aprendendo Arquitetura Framework Salesforce - Dia 03
Mauricio Alexandre Silva
 
grade 5 lesson matatag ENGLISH 5_Q1_PPT_WEEK4.pptx
SireQuinn
 
Chapter-V-DED-Entrepreneurship: Institutions Facilitating Entrepreneurship
Dayanand Huded
 
HUMAN RESOURCE MANAGEMENT: RECRUITMENT, SELECTION, PLACEMENT, DEPLOYMENT, TRA...
PRADEEP ABOTHU
 
0725.WHITEPAPER-UNIQUEWAYSOFPROTOTYPINGANDUXNOW.pdf
Thomas GIRARD, MA, CDP
 
PPT-Q1-WK-3-ENGLISH Revised Matatag Grade 3.pptx
reijhongidayawan02
 
QUARTER 1 WEEK 2 PLOT, POV AND CONFLICTS
KynaParas
 
PPT-Q1-WEEK-3-SCIENCE-ERevised Matatag Grade 3.pptx
reijhongidayawan02
 
Ad

Graph data structure and algorithms

  • 1. Graph Data Structure and Algorithms Presented by D.Anandhasilambarasan KIT - CBE
  • 2. Graph Data Structure and Algorithms A Graph is a non-linear data structure consisting of nodes and edges. The nodes are sometimes also referred to as vertices and the edges are lines or arcs that connect any two nodes in the graph. A Graph consists of a finite set of vertices (or nodes) and set of Edges which connect a pair of nodes.
  • 3.  Nodes: These are the most important components in any graph. Nodes are entities whose relationships are expressed using edges. If a graph comprises 2 nodes A and B and an undirected edge between them, then it expresses a bi-directional relationship between the nodes and edge.  Edges: Edges are the components that are used to represent the relationships between various nodes in a graph. An edge between two nodes expresses a one-way or two-way relationship between the nodes.
  • 4. - In the above Graph, the set of vertices V = {0,1,2,3,4} and the set of edges E = {01, 12, 23, 34, 04, 14, 13}.
  • 5. Types of graphs Undirected: An undirected graph is a graph in which all the edges are bi- directional i.e. the edges do not point in any specific direction. Directed: A directed graph is a graph in which all the edges are uni-directional i.e. the edges point in a single direction. Weighted: In a weighted graph, each edge is assigned a weight or cost. Cyclic: A graph is cyclic if the graph comprises a path that starts from a vertex and ends at the same vertex. That path is called a cycle. An acyclic graph is a graph that has no cycle.
  • 6. Graph Representation You can represent a graph in many ways. The two most common ways of representing a graph is as follows: Adjacency matrix Adjacency list Adjacency matrix An adjacency matrix is a VxV binary matrix A. Element Ai,j is 1 if there is an edge from vertex i to vertex j else Ai,jis 0. Note: A binary matrix is a matrix in which the cells can have only one of two possible values - either a 0 or 1.
  • 7. The adjacency matrix of the following graph is: i/j: 1 2 3 4 1: 0 1 0 1 2: 1 0 1 0 3: 0 1 0 1 4: 1 0 1 0 Adjacency list The other way to represent a graph is by using an adjacency list. An adjacency list is an array A of separate lists. Each element of the array Ai is a list, which contains all the vertices that are adjacent to vertex i. 1 2 34
  • 9. Applications of Graphs  Graphs are used to solve many real-life problems. Graphs are used to represent networks.  The networks may include paths in a city or telephone network or circuit network.  Graphs are also used in social networks like LinkedIn, Facebook.  It is used to Document link graphs.  Scene graphs: Such graphs are very important in the computer games industry.
  • 10.  Robot planning: Such graph plans are used in planning paths for Autonomous vehicles.  Neural networks  For example, in Facebook, each person is represented with a vertex (or node).  Each node is a structure and contains information like person id, name, gender, locale etc.