SlideShare a Scribd company logo
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.
Most read
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.
Most read
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
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)

Data structure - Graph
Data structure - GraphData structure - Graph
Data structure - Graph
Madhu Bala
 
Graphs In Data Structure
Graphs In Data StructureGraphs In Data Structure
Graphs In Data Structure
Anuj Modi
 
Graph representation
Graph representationGraph representation
Graph representation
Tech_MX
 
single linked list
single linked listsingle linked list
single linked list
Sathasivam Rangasamy
 
Heaps
HeapsHeaps
Heaps
Hafiz Atif Amin
 
Divide and conquer - Quick sort
Divide and conquer - Quick sortDivide and conquer - Quick sort
Divide and conquer - Quick sort
Madhu Bala
 
AVL Tree in Data Structure
AVL Tree in Data Structure AVL Tree in Data Structure
AVL Tree in Data Structure
Vrushali Dhanokar
 
AVL Tree
AVL TreeAVL Tree
AVL Tree
Dr Sandeep Kumar Poonia
 
Binary Search Tree
Binary Search TreeBinary Search Tree
Binary Search Tree
sagar yadav
 
Hashing
HashingHashing
Hashing
Amar Jukuntla
 
Terminology of tree
Terminology of treeTerminology of tree
Terminology of tree
RacksaviR
 
Bfs and Dfs
Bfs and DfsBfs and Dfs
Bfs and Dfs
Masud Parvaze
 
Lecture 16 memory bounded search
Lecture 16 memory bounded searchLecture 16 memory bounded search
Lecture 16 memory bounded search
Hema Kashyap
 
linked list in data structure
linked list in data structure linked list in data structure
linked list in data structure
shameen khan
 
Spanning trees
Spanning treesSpanning trees
Spanning trees
Shareb Ismaeel
 
Tree and graph
Tree and graphTree and graph
Tree and graph
Muhaiminul Islam
 
Threaded Binary Tree.pptx
Threaded Binary Tree.pptxThreaded Binary Tree.pptx
Threaded Binary Tree.pptx
pavankumarjakkepalli
 
Algorithms Lecture 7: Graph Algorithms
Algorithms Lecture 7: Graph AlgorithmsAlgorithms Lecture 7: Graph Algorithms
Algorithms Lecture 7: Graph Algorithms
Mohamed Loey
 
Priority queue in DSA
Priority queue in DSAPriority queue in DSA
Priority queue in DSA
junnubabu
 
Prim's Algorithm on minimum spanning tree
Prim's Algorithm on minimum spanning treePrim's Algorithm on minimum spanning tree
Prim's Algorithm on minimum spanning tree
oneous
 
Data structure - Graph
Data structure - GraphData structure - Graph
Data structure - Graph
Madhu Bala
 
Graphs In Data Structure
Graphs In Data StructureGraphs In Data Structure
Graphs In Data Structure
Anuj Modi
 
Graph representation
Graph representationGraph representation
Graph representation
Tech_MX
 
Divide and conquer - Quick sort
Divide and conquer - Quick sortDivide and conquer - Quick sort
Divide and conquer - Quick sort
Madhu Bala
 
Binary Search Tree
Binary Search TreeBinary Search Tree
Binary Search Tree
sagar yadav
 
Terminology of tree
Terminology of treeTerminology of tree
Terminology of tree
RacksaviR
 
Lecture 16 memory bounded search
Lecture 16 memory bounded searchLecture 16 memory bounded search
Lecture 16 memory bounded search
Hema Kashyap
 
linked list in data structure
linked list in data structure linked list in data structure
linked list in data structure
shameen khan
 
Algorithms Lecture 7: Graph Algorithms
Algorithms Lecture 7: Graph AlgorithmsAlgorithms Lecture 7: Graph Algorithms
Algorithms Lecture 7: Graph Algorithms
Mohamed Loey
 
Priority queue in DSA
Priority queue in DSAPriority queue in DSA
Priority queue in DSA
junnubabu
 
Prim's Algorithm on minimum spanning tree
Prim's Algorithm on minimum spanning treePrim's Algorithm on minimum spanning tree
Prim's Algorithm on minimum spanning tree
oneous
 

Similar to Graph data structure and algorithms (20)

Graphs in datastructures
Graphs in datastructuresGraphs in datastructures
Graphs in datastructures
LikhithaGunturi
 
Graphs in data structure
Graphs in data structureGraphs in data structure
Graphs in data structure
hamza javed
 
Graphs data structures
Graphs data structuresGraphs data structures
Graphs data structures
Jasleen Kaur (Chandigarh University)
 
Data Structure and algorithms - Graph1.pptx
Data Structure and algorithms - Graph1.pptxData Structure and algorithms - Graph1.pptx
Data Structure and algorithms - Graph1.pptx
Kishor767966
 
graphs presentation .pptx
graphs presentation .pptxgraphs presentation .pptx
graphs presentation .pptx
ssuser800a48
 
Basics of graph
Basics of graphBasics of graph
Basics of graph
Khaled Sany
 
Lecture 5b graphs and hashing
Lecture 5b graphs and hashingLecture 5b graphs and hashing
Lecture 5b graphs and hashing
Victor Palmar
 
Unit II_Graph.pptxkgjrekjgiojtoiejhgnltegjte
Unit II_Graph.pptxkgjrekjgiojtoiejhgnltegjteUnit II_Graph.pptxkgjrekjgiojtoiejhgnltegjte
Unit II_Graph.pptxkgjrekjgiojtoiejhgnltegjte
pournima055
 
graph representation.pdf
graph representation.pdfgraph representation.pdf
graph representation.pdf
amitbhachne
 
Graph Basic In Data structure
Graph Basic In Data structureGraph Basic In Data structure
Graph Basic In Data structure
Ikhlas Rahman
 
Techniques for graph
Techniques for graphTechniques for graph
Techniques for graph
SOWNDARYASUGCOMPUTER
 
DATA STRUCTURES unit 4.pptx
DATA STRUCTURES unit 4.pptxDATA STRUCTURES unit 4.pptx
DATA STRUCTURES unit 4.pptx
ShivamKrPathak
 
Graphs in Data Structure
 Graphs in Data Structure Graphs in Data Structure
Graphs in Data Structure
hafsa komal
 
Lecture 14 data structures and algorithms
Lecture 14 data structures and algorithmsLecture 14 data structures and algorithms
Lecture 14 data structures and algorithms
Aakash deep Singhal
 
Graph theory ppt.pptx
Graph theory ppt.pptxGraph theory ppt.pptx
Graph theory ppt.pptx
saranyajey
 
Chapter 6-DS(Introduction to Graph and its terminologies).pptx
Chapter 6-DS(Introduction to Graph and its terminologies).pptxChapter 6-DS(Introduction to Graph and its terminologies).pptx
Chapter 6-DS(Introduction to Graph and its terminologies).pptx
nasalapurepallavi272
 
graphs in data structure for Btech students.pdf
graphs in data structure for Btech students.pdfgraphs in data structure for Btech students.pdf
graphs in data structure for Btech students.pdf
soniasharmafdp
 
UNIT IV NON LINEAR DATA STRUCTURES - GRAPH
UNIT IV NON LINEAR DATA STRUCTURES - GRAPHUNIT IV NON LINEAR DATA STRUCTURES - GRAPH
UNIT IV NON LINEAR DATA STRUCTURES - GRAPH
VISWANATHAN R V
 
UNIT IV NON LINEAR DATA STRUCTURES - GRAPH.pptx
UNIT IV NON LINEAR DATA STRUCTURES - GRAPH.pptxUNIT IV NON LINEAR DATA STRUCTURES - GRAPH.pptx
UNIT IV NON LINEAR DATA STRUCTURES - GRAPH.pptx
kncetaruna
 
Chap 6 Graph.ppt
Chap 6 Graph.pptChap 6 Graph.ppt
Chap 6 Graph.ppt
shashankbhadouria4
 
Graphs in datastructures
Graphs in datastructuresGraphs in datastructures
Graphs in datastructures
LikhithaGunturi
 
Graphs in data structure
Graphs in data structureGraphs in data structure
Graphs in data structure
hamza javed
 
Data Structure and algorithms - Graph1.pptx
Data Structure and algorithms - Graph1.pptxData Structure and algorithms - Graph1.pptx
Data Structure and algorithms - Graph1.pptx
Kishor767966
 
graphs presentation .pptx
graphs presentation .pptxgraphs presentation .pptx
graphs presentation .pptx
ssuser800a48
 
Lecture 5b graphs and hashing
Lecture 5b graphs and hashingLecture 5b graphs and hashing
Lecture 5b graphs and hashing
Victor Palmar
 
Unit II_Graph.pptxkgjrekjgiojtoiejhgnltegjte
Unit II_Graph.pptxkgjrekjgiojtoiejhgnltegjteUnit II_Graph.pptxkgjrekjgiojtoiejhgnltegjte
Unit II_Graph.pptxkgjrekjgiojtoiejhgnltegjte
pournima055
 
graph representation.pdf
graph representation.pdfgraph representation.pdf
graph representation.pdf
amitbhachne
 
Graph Basic In Data structure
Graph Basic In Data structureGraph Basic In Data structure
Graph Basic In Data structure
Ikhlas Rahman
 
DATA STRUCTURES unit 4.pptx
DATA STRUCTURES unit 4.pptxDATA STRUCTURES unit 4.pptx
DATA STRUCTURES unit 4.pptx
ShivamKrPathak
 
Graphs in Data Structure
 Graphs in Data Structure Graphs in Data Structure
Graphs in Data Structure
hafsa komal
 
Lecture 14 data structures and algorithms
Lecture 14 data structures and algorithmsLecture 14 data structures and algorithms
Lecture 14 data structures and algorithms
Aakash deep Singhal
 
Graph theory ppt.pptx
Graph theory ppt.pptxGraph theory ppt.pptx
Graph theory ppt.pptx
saranyajey
 
Chapter 6-DS(Introduction to Graph and its terminologies).pptx
Chapter 6-DS(Introduction to Graph and its terminologies).pptxChapter 6-DS(Introduction to Graph and its terminologies).pptx
Chapter 6-DS(Introduction to Graph and its terminologies).pptx
nasalapurepallavi272
 
graphs in data structure for Btech students.pdf
graphs in data structure for Btech students.pdfgraphs in data structure for Btech students.pdf
graphs in data structure for Btech students.pdf
soniasharmafdp
 
UNIT IV NON LINEAR DATA STRUCTURES - GRAPH
UNIT IV NON LINEAR DATA STRUCTURES - GRAPHUNIT IV NON LINEAR DATA STRUCTURES - GRAPH
UNIT IV NON LINEAR DATA STRUCTURES - GRAPH
VISWANATHAN R V
 
UNIT IV NON LINEAR DATA STRUCTURES - GRAPH.pptx
UNIT IV NON LINEAR DATA STRUCTURES - GRAPH.pptxUNIT IV NON LINEAR DATA STRUCTURES - GRAPH.pptx
UNIT IV NON LINEAR DATA STRUCTURES - GRAPH.pptx
kncetaruna
 
Ad

Recently uploaded (20)

june 10 2025 ppt for madden on art science is over.pptx
june 10 2025 ppt for madden on art science is over.pptxjune 10 2025 ppt for madden on art science is over.pptx
june 10 2025 ppt for madden on art science is over.pptx
roger malina
 
Ray Dalio How Countries go Broke the Big Cycle
Ray Dalio How Countries go Broke the Big CycleRay Dalio How Countries go Broke the Big Cycle
Ray Dalio How Countries go Broke the Big Cycle
Dadang Solihin
 
Parenting Teens: Supporting Trust, resilience and independence
Parenting Teens: Supporting Trust, resilience and independenceParenting Teens: Supporting Trust, resilience and independence
Parenting Teens: Supporting Trust, resilience and independence
Pooky Knightsmith
 
How to Create a Rainbow Man Effect in Odoo 18
How to Create a Rainbow Man Effect in Odoo 18How to Create a Rainbow Man Effect in Odoo 18
How to Create a Rainbow Man Effect in Odoo 18
Celine George
 
Unit- 4 Biostatistics & Research Methodology.pdf
Unit- 4 Biostatistics & Research Methodology.pdfUnit- 4 Biostatistics & Research Methodology.pdf
Unit- 4 Biostatistics & Research Methodology.pdf
KRUTIKA CHANNE
 
Basic English for Communication - Dr Hj Euis Eti Rohaeti Mpd
Basic English for Communication - Dr Hj Euis Eti Rohaeti MpdBasic English for Communication - Dr Hj Euis Eti Rohaeti Mpd
Basic English for Communication - Dr Hj Euis Eti Rohaeti Mpd
Restu Bias Primandhika
 
Different pricelists for different shops in odoo Point of Sale in Odoo 17
Different pricelists for different shops in odoo Point of Sale in Odoo 17Different pricelists for different shops in odoo Point of Sale in Odoo 17
Different pricelists for different shops in odoo Point of Sale in Odoo 17
Celine George
 
Final Sketch Designs for poster production.pptx
Final Sketch Designs for poster production.pptxFinal Sketch Designs for poster production.pptx
Final Sketch Designs for poster production.pptx
bobby205207
 
Allomorps and word formation.pptx - Google Slides.pdf
Allomorps and word formation.pptx - Google Slides.pdfAllomorps and word formation.pptx - Google Slides.pdf
Allomorps and word formation.pptx - Google Slides.pdf
Abha Pandey
 
IDF 30min presentation - December 2, 2024.pptx
IDF 30min presentation - December 2, 2024.pptxIDF 30min presentation - December 2, 2024.pptx
IDF 30min presentation - December 2, 2024.pptx
ArneeAgligar
 
How to Configure Vendor Management in Lunch App of Odoo 18
How to Configure Vendor Management in Lunch App of Odoo 18How to Configure Vendor Management in Lunch App of Odoo 18
How to Configure Vendor Management in Lunch App of Odoo 18
Celine George
 
FEBA Sofia Univercity final diplian v3 GSDG 5.2025.pdf
FEBA Sofia Univercity final diplian v3 GSDG 5.2025.pdfFEBA Sofia Univercity final diplian v3 GSDG 5.2025.pdf
FEBA Sofia Univercity final diplian v3 GSDG 5.2025.pdf
ChristinaFortunova
 
How to Manage & Create a New Department in Odoo 18 Employee
How to Manage & Create a New Department in Odoo 18 EmployeeHow to Manage & Create a New Department in Odoo 18 Employee
How to Manage & Create a New Department in Odoo 18 Employee
Celine George
 
Diptera: The Two-Winged Wonders, The Fly Squad: Order Diptera.pptx
Diptera: The Two-Winged Wonders, The Fly Squad: Order Diptera.pptxDiptera: The Two-Winged Wonders, The Fly Squad: Order Diptera.pptx
Diptera: The Two-Winged Wonders, The Fly Squad: Order Diptera.pptx
Arshad Shaikh
 
BUSINESS QUIZ PRELIMS | QUIZ CLUB OF PSGCAS | 9 SEPTEMBER 2024
BUSINESS QUIZ PRELIMS | QUIZ CLUB OF PSGCAS | 9 SEPTEMBER 2024BUSINESS QUIZ PRELIMS | QUIZ CLUB OF PSGCAS | 9 SEPTEMBER 2024
BUSINESS QUIZ PRELIMS | QUIZ CLUB OF PSGCAS | 9 SEPTEMBER 2024
Quiz Club of PSG College of Arts & Science
 
EUPHORIA GENERAL QUIZ FINALS | QUIZ CLUB OF PSGCAS | 21 MARCH 2025
EUPHORIA GENERAL QUIZ FINALS | QUIZ CLUB OF PSGCAS | 21 MARCH 2025EUPHORIA GENERAL QUIZ FINALS | QUIZ CLUB OF PSGCAS | 21 MARCH 2025
EUPHORIA GENERAL QUIZ FINALS | QUIZ CLUB OF PSGCAS | 21 MARCH 2025
Quiz Club of PSG College of Arts & Science
 
How to Manage Maintenance Request in Odoo 18
How to Manage Maintenance Request in Odoo 18How to Manage Maintenance Request in Odoo 18
How to Manage Maintenance Request in Odoo 18
Celine George
 
Black and White Illustrative Group Project Presentation.pdf (1).pdf
Black and White Illustrative Group Project Presentation.pdf (1).pdfBlack and White Illustrative Group Project Presentation.pdf (1).pdf
Black and White Illustrative Group Project Presentation.pdf (1).pdf
AnnasofiaUrsini
 
SEXUALITY , UNWANTED PREGANCY AND SEXUAL ASSAULT .pptx
SEXUALITY , UNWANTED PREGANCY AND SEXUAL ASSAULT .pptxSEXUALITY , UNWANTED PREGANCY AND SEXUAL ASSAULT .pptx
SEXUALITY , UNWANTED PREGANCY AND SEXUAL ASSAULT .pptx
PoojaSen20
 
LDMMIA Free Reiki Yoga S9 Grad Level Intuition II
LDMMIA Free Reiki Yoga S9 Grad Level Intuition IILDMMIA Free Reiki Yoga S9 Grad Level Intuition II
LDMMIA Free Reiki Yoga S9 Grad Level Intuition II
LDM & Mia eStudios
 
june 10 2025 ppt for madden on art science is over.pptx
june 10 2025 ppt for madden on art science is over.pptxjune 10 2025 ppt for madden on art science is over.pptx
june 10 2025 ppt for madden on art science is over.pptx
roger malina
 
Ray Dalio How Countries go Broke the Big Cycle
Ray Dalio How Countries go Broke the Big CycleRay Dalio How Countries go Broke the Big Cycle
Ray Dalio How Countries go Broke the Big Cycle
Dadang Solihin
 
Parenting Teens: Supporting Trust, resilience and independence
Parenting Teens: Supporting Trust, resilience and independenceParenting Teens: Supporting Trust, resilience and independence
Parenting Teens: Supporting Trust, resilience and independence
Pooky Knightsmith
 
How to Create a Rainbow Man Effect in Odoo 18
How to Create a Rainbow Man Effect in Odoo 18How to Create a Rainbow Man Effect in Odoo 18
How to Create a Rainbow Man Effect in Odoo 18
Celine George
 
Unit- 4 Biostatistics & Research Methodology.pdf
Unit- 4 Biostatistics & Research Methodology.pdfUnit- 4 Biostatistics & Research Methodology.pdf
Unit- 4 Biostatistics & Research Methodology.pdf
KRUTIKA CHANNE
 
Basic English for Communication - Dr Hj Euis Eti Rohaeti Mpd
Basic English for Communication - Dr Hj Euis Eti Rohaeti MpdBasic English for Communication - Dr Hj Euis Eti Rohaeti Mpd
Basic English for Communication - Dr Hj Euis Eti Rohaeti Mpd
Restu Bias Primandhika
 
Different pricelists for different shops in odoo Point of Sale in Odoo 17
Different pricelists for different shops in odoo Point of Sale in Odoo 17Different pricelists for different shops in odoo Point of Sale in Odoo 17
Different pricelists for different shops in odoo Point of Sale in Odoo 17
Celine George
 
Final Sketch Designs for poster production.pptx
Final Sketch Designs for poster production.pptxFinal Sketch Designs for poster production.pptx
Final Sketch Designs for poster production.pptx
bobby205207
 
Allomorps and word formation.pptx - Google Slides.pdf
Allomorps and word formation.pptx - Google Slides.pdfAllomorps and word formation.pptx - Google Slides.pdf
Allomorps and word formation.pptx - Google Slides.pdf
Abha Pandey
 
IDF 30min presentation - December 2, 2024.pptx
IDF 30min presentation - December 2, 2024.pptxIDF 30min presentation - December 2, 2024.pptx
IDF 30min presentation - December 2, 2024.pptx
ArneeAgligar
 
How to Configure Vendor Management in Lunch App of Odoo 18
How to Configure Vendor Management in Lunch App of Odoo 18How to Configure Vendor Management in Lunch App of Odoo 18
How to Configure Vendor Management in Lunch App of Odoo 18
Celine George
 
FEBA Sofia Univercity final diplian v3 GSDG 5.2025.pdf
FEBA Sofia Univercity final diplian v3 GSDG 5.2025.pdfFEBA Sofia Univercity final diplian v3 GSDG 5.2025.pdf
FEBA Sofia Univercity final diplian v3 GSDG 5.2025.pdf
ChristinaFortunova
 
How to Manage & Create a New Department in Odoo 18 Employee
How to Manage & Create a New Department in Odoo 18 EmployeeHow to Manage & Create a New Department in Odoo 18 Employee
How to Manage & Create a New Department in Odoo 18 Employee
Celine George
 
Diptera: The Two-Winged Wonders, The Fly Squad: Order Diptera.pptx
Diptera: The Two-Winged Wonders, The Fly Squad: Order Diptera.pptxDiptera: The Two-Winged Wonders, The Fly Squad: Order Diptera.pptx
Diptera: The Two-Winged Wonders, The Fly Squad: Order Diptera.pptx
Arshad Shaikh
 
How to Manage Maintenance Request in Odoo 18
How to Manage Maintenance Request in Odoo 18How to Manage Maintenance Request in Odoo 18
How to Manage Maintenance Request in Odoo 18
Celine George
 
Black and White Illustrative Group Project Presentation.pdf (1).pdf
Black and White Illustrative Group Project Presentation.pdf (1).pdfBlack and White Illustrative Group Project Presentation.pdf (1).pdf
Black and White Illustrative Group Project Presentation.pdf (1).pdf
AnnasofiaUrsini
 
SEXUALITY , UNWANTED PREGANCY AND SEXUAL ASSAULT .pptx
SEXUALITY , UNWANTED PREGANCY AND SEXUAL ASSAULT .pptxSEXUALITY , UNWANTED PREGANCY AND SEXUAL ASSAULT .pptx
SEXUALITY , UNWANTED PREGANCY AND SEXUAL ASSAULT .pptx
PoojaSen20
 
LDMMIA Free Reiki Yoga S9 Grad Level Intuition II
LDMMIA Free Reiki Yoga S9 Grad Level Intuition IILDMMIA Free Reiki Yoga S9 Grad Level Intuition II
LDMMIA Free Reiki Yoga S9 Grad Level Intuition II
LDM & Mia eStudios
 
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.