SlideShare a Scribd company logo
1 of 13
Chapter 8
Graph
Graph Terminologies
By Prof. Raj Sarode 2
Graph is a non Linear Data structure which is a collection of two finite sets of V & E
Where V is vertices(node) and E is Edges (arcs)
i.e. G = (V, E)
Where V = {A, B, C, D, E, F} &
E = { (A, B}, (A,C), (B,C), (B,D), (C,D), (C,E), (D,E), (D,F), (E,F)}
The pair (A,B) defines an edge between A and B.
AE.g. B D
C E F
The number of vertices of graph constitute the order of graph. Hence In given
Example the order of graph is Six
By Prof. Raj Sarode 3
Graph
1. Adjacent vertices: Two vertices are said to be adjacent if they are connected by an
edge.
e.g. B & C
2. Adjacent Edges: Two edges are said to be adjacent if they are incident on the common
vertex.
e.g. CD & CE.
3. Path: A Path is a sequence of distinct vertices in which each vertex is adjacent to next
one.
e.g. ABCDEF
4. Cycle: A cycle is a path consisting of at least three vertices where last vertex is adjacent
to the first vertex.
e.g. C D F E C
5. Loop: It is special cycle that start and end with same vertex without visiting any other
vertex.
6. Degree of Vertex: The degree of a vertex is the number of lines incident on it
e.g. degree of D is 4
7. Out-Degree: The out Degree of directed graph is the number of arcs leaving the vertex.
8. In-Degree: In degree of directed graph is number of arcs entering the vertex.
9. Multiple Edges: The distinct parallel edges that connect the same end point.
Types of Graph
By Prof. Raj Sarode 4
1. Simple Graph: A graph that does not contain any loop or multiple edges
B
C E
A D
2. Multi graph: A graph that contain more then one edges between two vertices
B
C E
A D
Types of Graph
By Prof. Raj Sarode 5
3. Directed Graph: A graph with directed edges is called directed graph
B
C E
A D
4. Undirected Graph: A graph with undirected edges is called undirected graph
B
C E
A D
Types of Graph
By Prof. Raj Sarode 6
5. Weighted Graph: A graph with Weight (value) assign to edges is called weighted graph
6. Regular Graph: A graph in which each vertex has same degree is called regular graph
B
C D
A
B
C E
A D2 5
79
6
4
Note: k is degree of each vertex
hence it is called k regular graph
Types of Graph
By Prof. Raj Sarode 7
7. Complete Graph: A graph in which each vertex is connected to every other vertices
called complete graph
8. Strongly connected Graph: In Directed graph each vertex is connected to every
other vertices called Strongly connected graph
B
C D
A
B
C D
A
Types of Graph
By Prof. Raj Sarode 8
9. Weakly connected Graph: In Directed graph weakly connected if at least two
vertices are not connected.
B
C D
A
10. Isomorphic Graph: Two graph in which there is one to one correspondence
between their vertices and their edges is said to be isomorphic graph .
B
C D
A
F
E
G H
Representation of Graph
By Prof. Raj Sarode 9
1. Sequential Representation using adjacency matrix
B
C E
A D
A
B
C
D
E
A
0
1
1
0
0
B
1
0
1
1
0
C
1
1
0
0
1
D
0
1
0
0
1
E
0
0
1
1
0
Adjacency Matrix of
Undirected Graph
B
C E
A D
A
B
C
D
E
A
0
0
1
0
0
B
1
0
1
0
0
C
0
0
0
0
0
D
0
1
0
0
1
E
0
0
1
0
0
Adjacency Matrix of
Directed Graph
Representation of Graph
By Prof. Raj Sarode 10
2. Linked Representation using adjacency List
B
C E
A DB
C E
A D
Name
Link to
next node
Link to another list
of adjacent node
Structure of Node List
Adjacent
node
Link
Structure of Edge List
A
B
C
D
E
Node List
B C X
A C D X
A B E X
B E X
C D X
A
B
C
D X
E
Node List
B X
D X
A B E X
D X
Adjacency List of undirected Graph Adjacency List of directed Graph
E.g. 1 E.g. 2
Traversal of Graph
By Prof. Raj Sarode 11
1. Breadth First Search ( BFS)
•First we visit the starting vertex and then all the vertices adjacent to starting
vertex.
•After this we pick these adjacent vertices one by one and visit their adjacent
vertices and this process goes on.
•In BFS we use the concept of Queue & any vertex will be in one of the three state-
(initial, waiting, visited),
The procedure for BFS is as follow
1. Initially the queue is empty, and all the vertices are in initial state.
2. Insert the starting vertex into the queue, change its state to waiting.
3. Delete front element from queue and visit it, change its state to visited.
4. Look for adjacent vertices of deleted element, and insert only those vertices
into queue which are in the initial state.
5. Change the state of all inserted vertices from initial to waiting.
6. Repeat step 3,4,5 until the queue is empty.
Traversal of Graph
By Prof. Raj Sarode 12
2. Depth First Search ( DFS)
•First we visit the starting vertex and we will pick up any path that start from
starting vertex and visit all the vertices in the path till Dead end occur
•In DFS we use the concept of Stack & any vertex will be in one of the two state-
(initial, visited),
The procedure for DFS is as follow
1. Initially the Stack is empty, and all the vertices are in initial state.
2. PUSH starting vertex into the stack.
3. POP a vertex from stack.
4. If the Popped vertex is in initial state, visit it and change its state to visited
5. PUSH all the unvisited vertex adjacent to the popped vertex.
6. Repeat step 3,4,5 until the stack is empty.
Thank You
By Prof. Raj Sarode 13

More Related Content

What's hot (20)

DFS and BFS
DFS and BFSDFS and BFS
DFS and BFS
 
Binary tree traversal ppt - 02.03.2020
Binary tree traversal   ppt - 02.03.2020Binary tree traversal   ppt - 02.03.2020
Binary tree traversal ppt - 02.03.2020
 
Binary tree
Binary tree Binary tree
Binary tree
 
Tree-In Data Structure
Tree-In Data StructureTree-In Data Structure
Tree-In Data Structure
 
Binary tree
Binary  treeBinary  tree
Binary tree
 
Data Structure (Tree)
Data Structure (Tree)Data Structure (Tree)
Data Structure (Tree)
 
THREADED BINARY TREE AND BINARY SEARCH TREE
THREADED BINARY TREE AND BINARY SEARCH TREETHREADED BINARY TREE AND BINARY SEARCH TREE
THREADED BINARY TREE AND BINARY SEARCH TREE
 
Data Structure and Algorithms AVL Trees
Data Structure and Algorithms AVL TreesData Structure and Algorithms AVL Trees
Data Structure and Algorithms AVL Trees
 
Depth-First Search
Depth-First SearchDepth-First Search
Depth-First Search
 
Trees (data structure)
Trees (data structure)Trees (data structure)
Trees (data structure)
 
Adjacency list
Adjacency listAdjacency list
Adjacency list
 
Balanced Tree (AVL Tree & Red-Black Tree)
Balanced Tree (AVL Tree & Red-Black Tree)Balanced Tree (AVL Tree & Red-Black Tree)
Balanced Tree (AVL Tree & Red-Black Tree)
 
Graph data structure and algorithms
Graph data structure and algorithmsGraph data structure and algorithms
Graph data structure and algorithms
 
Trees
TreesTrees
Trees
 
Binary search tree in data structures
Binary search tree in  data structuresBinary search tree in  data structures
Binary search tree in data structures
 
Depth First Search ( DFS )
Depth First Search ( DFS )Depth First Search ( DFS )
Depth First Search ( DFS )
 
Graph in data structure
Graph in data structureGraph in data structure
Graph in data structure
 
Data Structure and Algorithms Binary Tree
Data Structure and Algorithms Binary TreeData Structure and Algorithms Binary Tree
Data Structure and Algorithms Binary Tree
 
Trees data structure
Trees data structureTrees data structure
Trees data structure
 
Breadth First Search & Depth First Search
Breadth First Search & Depth First SearchBreadth First Search & Depth First Search
Breadth First Search & Depth First Search
 

Viewers also liked

Chap 7 binary threaded tree
Chap 7 binary threaded treeChap 7 binary threaded tree
Chap 7 binary threaded treeRaj Sarode
 
4.7 graph linear functions day 1
4.7 graph linear functions   day 14.7 graph linear functions   day 1
4.7 graph linear functions day 1bweldon
 
Demographic research
Demographic researchDemographic research
Demographic researchMoheco
 
Thriller demographic 2
Thriller demographic 2Thriller demographic 2
Thriller demographic 2gabija baksyte
 
Chronocycle graph
Chronocycle graphChronocycle graph
Chronocycle graphBinoy Benny
 
Chap 1 introduction to cloud computing
Chap 1 introduction to cloud computingChap 1 introduction to cloud computing
Chap 1 introduction to cloud computingRaj Sarode
 
Chap 6 cloud security
Chap 6 cloud securityChap 6 cloud security
Chap 6 cloud securityRaj Sarode
 
Chap 5 software as a service (saass)
Chap 5 software as a service (saass)Chap 5 software as a service (saass)
Chap 5 software as a service (saass)Raj Sarode
 
Chap 4 platform as a service (paa s)
Chap 4 platform as a service (paa s)Chap 4 platform as a service (paa s)
Chap 4 platform as a service (paa s)Raj Sarode
 
Chap 3 infrastructure as a service(iaas)
Chap 3 infrastructure as a service(iaas)Chap 3 infrastructure as a service(iaas)
Chap 3 infrastructure as a service(iaas)Raj Sarode
 
Solution of linear equation & inequality
Solution of linear equation & inequalitySolution of linear equation & inequality
Solution of linear equation & inequalityflorian Manzanilla
 
Discrete math ppt
Discrete math pptDiscrete math ppt
Discrete math pptmsumerton
 
Introduction of data structure
Introduction of data structureIntroduction of data structure
Introduction of data structureeShikshak
 
Recording techniques used in method study ppt
Recording techniques used in method study pptRecording techniques used in method study ppt
Recording techniques used in method study pptBeereddy Swapna
 
CES 2017: NVIDIA Highlights
CES 2017: NVIDIA HighlightsCES 2017: NVIDIA Highlights
CES 2017: NVIDIA HighlightsNVIDIA
 
Linear Equations Ppt
Linear Equations PptLinear Equations Ppt
Linear Equations PptScott R
 
introduction to graph theory
introduction to graph theoryintroduction to graph theory
introduction to graph theoryChuckie Balbuena
 

Viewers also liked (20)

Chap 7 binary threaded tree
Chap 7 binary threaded treeChap 7 binary threaded tree
Chap 7 binary threaded tree
 
4.7 graph linear functions day 1
4.7 graph linear functions   day 14.7 graph linear functions   day 1
4.7 graph linear functions day 1
 
Demographic research
Demographic researchDemographic research
Demographic research
 
Thriller demographic 2
Thriller demographic 2Thriller demographic 2
Thriller demographic 2
 
Chronocycle graph
Chronocycle graphChronocycle graph
Chronocycle graph
 
Work study
Work studyWork study
Work study
 
stack
stackstack
stack
 
Chap 1 introduction to cloud computing
Chap 1 introduction to cloud computingChap 1 introduction to cloud computing
Chap 1 introduction to cloud computing
 
Chap 6 cloud security
Chap 6 cloud securityChap 6 cloud security
Chap 6 cloud security
 
Queue
QueueQueue
Queue
 
Chap 5 software as a service (saass)
Chap 5 software as a service (saass)Chap 5 software as a service (saass)
Chap 5 software as a service (saass)
 
Chap 4 platform as a service (paa s)
Chap 4 platform as a service (paa s)Chap 4 platform as a service (paa s)
Chap 4 platform as a service (paa s)
 
Chap 3 infrastructure as a service(iaas)
Chap 3 infrastructure as a service(iaas)Chap 3 infrastructure as a service(iaas)
Chap 3 infrastructure as a service(iaas)
 
Solution of linear equation & inequality
Solution of linear equation & inequalitySolution of linear equation & inequality
Solution of linear equation & inequality
 
Discrete math ppt
Discrete math pptDiscrete math ppt
Discrete math ppt
 
Introduction of data structure
Introduction of data structureIntroduction of data structure
Introduction of data structure
 
Recording techniques used in method study ppt
Recording techniques used in method study pptRecording techniques used in method study ppt
Recording techniques used in method study ppt
 
CES 2017: NVIDIA Highlights
CES 2017: NVIDIA HighlightsCES 2017: NVIDIA Highlights
CES 2017: NVIDIA Highlights
 
Linear Equations Ppt
Linear Equations PptLinear Equations Ppt
Linear Equations Ppt
 
introduction to graph theory
introduction to graph theoryintroduction to graph theory
introduction to graph theory
 

Similar to Graph Terminologies and Representations

Similar to Graph Terminologies and Representations (20)

Unit-6 Graph.ppsx ppt
Unit-6 Graph.ppsx                                       pptUnit-6 Graph.ppsx                                       ppt
Unit-6 Graph.ppsx ppt
 
Graphs
GraphsGraphs
Graphs
 
Algorithms and data Chapter 3 V Graph.pptx
Algorithms and data Chapter 3 V Graph.pptxAlgorithms and data Chapter 3 V Graph.pptx
Algorithms and data Chapter 3 V Graph.pptx
 
Data structure
Data structureData structure
Data structure
 
Unit 4.2(graphs)
Unit 4.2(graphs)Unit 4.2(graphs)
Unit 4.2(graphs)
 
Graphs in data structures
Graphs in data structuresGraphs in data structures
Graphs in data structures
 
graph.pptx
graph.pptxgraph.pptx
graph.pptx
 
LEC 12-DSALGO-GRAPHS(final12).pdf
LEC 12-DSALGO-GRAPHS(final12).pdfLEC 12-DSALGO-GRAPHS(final12).pdf
LEC 12-DSALGO-GRAPHS(final12).pdf
 
Graphs
GraphsGraphs
Graphs
 
Lecture 2.3.1 Graph.pptx
Lecture 2.3.1 Graph.pptxLecture 2.3.1 Graph.pptx
Lecture 2.3.1 Graph.pptx
 
Graph Introduction.ppt
Graph Introduction.pptGraph Introduction.ppt
Graph Introduction.ppt
 
Spanningtreesppt
SpanningtreespptSpanningtreesppt
Spanningtreesppt
 
Graph therory
Graph theroryGraph therory
Graph therory
 
Graphs
GraphsGraphs
Graphs
 
Lecture 5b graphs and hashing
Lecture 5b graphs and hashingLecture 5b graphs and hashing
Lecture 5b graphs and hashing
 
Graph Terminology - patent edge,Dominant vertex
Graph Terminology - patent edge,Dominant vertexGraph Terminology - patent edge,Dominant vertex
Graph Terminology - patent edge,Dominant vertex
 
Graphs and eularian circuit & path with c++ program
Graphs and eularian circuit & path with c++ programGraphs and eularian circuit & path with c++ program
Graphs and eularian circuit & path with c++ program
 
Graphs
GraphsGraphs
Graphs
 
09_DS_MCA_Graphs.pdf
09_DS_MCA_Graphs.pdf09_DS_MCA_Graphs.pdf
09_DS_MCA_Graphs.pdf
 
Graph Basic In Data structure
Graph Basic In Data structureGraph Basic In Data structure
Graph Basic In Data structure
 

Recently uploaded

Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
Clustering techniques data mining book ....
Clustering techniques data mining book ....Clustering techniques data mining book ....
Clustering techniques data mining book ....ShaimaaMohamedGalal
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 

Recently uploaded (20)

Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Exploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the ProcessExploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the Process
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
Clustering techniques data mining book ....
Clustering techniques data mining book ....Clustering techniques data mining book ....
Clustering techniques data mining book ....
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 

Graph Terminologies and Representations

  • 2. Graph Terminologies By Prof. Raj Sarode 2 Graph is a non Linear Data structure which is a collection of two finite sets of V & E Where V is vertices(node) and E is Edges (arcs) i.e. G = (V, E) Where V = {A, B, C, D, E, F} & E = { (A, B}, (A,C), (B,C), (B,D), (C,D), (C,E), (D,E), (D,F), (E,F)} The pair (A,B) defines an edge between A and B. AE.g. B D C E F The number of vertices of graph constitute the order of graph. Hence In given Example the order of graph is Six
  • 3. By Prof. Raj Sarode 3 Graph 1. Adjacent vertices: Two vertices are said to be adjacent if they are connected by an edge. e.g. B & C 2. Adjacent Edges: Two edges are said to be adjacent if they are incident on the common vertex. e.g. CD & CE. 3. Path: A Path is a sequence of distinct vertices in which each vertex is adjacent to next one. e.g. ABCDEF 4. Cycle: A cycle is a path consisting of at least three vertices where last vertex is adjacent to the first vertex. e.g. C D F E C 5. Loop: It is special cycle that start and end with same vertex without visiting any other vertex. 6. Degree of Vertex: The degree of a vertex is the number of lines incident on it e.g. degree of D is 4 7. Out-Degree: The out Degree of directed graph is the number of arcs leaving the vertex. 8. In-Degree: In degree of directed graph is number of arcs entering the vertex. 9. Multiple Edges: The distinct parallel edges that connect the same end point.
  • 4. Types of Graph By Prof. Raj Sarode 4 1. Simple Graph: A graph that does not contain any loop or multiple edges B C E A D 2. Multi graph: A graph that contain more then one edges between two vertices B C E A D
  • 5. Types of Graph By Prof. Raj Sarode 5 3. Directed Graph: A graph with directed edges is called directed graph B C E A D 4. Undirected Graph: A graph with undirected edges is called undirected graph B C E A D
  • 6. Types of Graph By Prof. Raj Sarode 6 5. Weighted Graph: A graph with Weight (value) assign to edges is called weighted graph 6. Regular Graph: A graph in which each vertex has same degree is called regular graph B C D A B C E A D2 5 79 6 4 Note: k is degree of each vertex hence it is called k regular graph
  • 7. Types of Graph By Prof. Raj Sarode 7 7. Complete Graph: A graph in which each vertex is connected to every other vertices called complete graph 8. Strongly connected Graph: In Directed graph each vertex is connected to every other vertices called Strongly connected graph B C D A B C D A
  • 8. Types of Graph By Prof. Raj Sarode 8 9. Weakly connected Graph: In Directed graph weakly connected if at least two vertices are not connected. B C D A 10. Isomorphic Graph: Two graph in which there is one to one correspondence between their vertices and their edges is said to be isomorphic graph . B C D A F E G H
  • 9. Representation of Graph By Prof. Raj Sarode 9 1. Sequential Representation using adjacency matrix B C E A D A B C D E A 0 1 1 0 0 B 1 0 1 1 0 C 1 1 0 0 1 D 0 1 0 0 1 E 0 0 1 1 0 Adjacency Matrix of Undirected Graph B C E A D A B C D E A 0 0 1 0 0 B 1 0 1 0 0 C 0 0 0 0 0 D 0 1 0 0 1 E 0 0 1 0 0 Adjacency Matrix of Directed Graph
  • 10. Representation of Graph By Prof. Raj Sarode 10 2. Linked Representation using adjacency List B C E A DB C E A D Name Link to next node Link to another list of adjacent node Structure of Node List Adjacent node Link Structure of Edge List A B C D E Node List B C X A C D X A B E X B E X C D X A B C D X E Node List B X D X A B E X D X Adjacency List of undirected Graph Adjacency List of directed Graph E.g. 1 E.g. 2
  • 11. Traversal of Graph By Prof. Raj Sarode 11 1. Breadth First Search ( BFS) •First we visit the starting vertex and then all the vertices adjacent to starting vertex. •After this we pick these adjacent vertices one by one and visit their adjacent vertices and this process goes on. •In BFS we use the concept of Queue & any vertex will be in one of the three state- (initial, waiting, visited), The procedure for BFS is as follow 1. Initially the queue is empty, and all the vertices are in initial state. 2. Insert the starting vertex into the queue, change its state to waiting. 3. Delete front element from queue and visit it, change its state to visited. 4. Look for adjacent vertices of deleted element, and insert only those vertices into queue which are in the initial state. 5. Change the state of all inserted vertices from initial to waiting. 6. Repeat step 3,4,5 until the queue is empty.
  • 12. Traversal of Graph By Prof. Raj Sarode 12 2. Depth First Search ( DFS) •First we visit the starting vertex and we will pick up any path that start from starting vertex and visit all the vertices in the path till Dead end occur •In DFS we use the concept of Stack & any vertex will be in one of the two state- (initial, visited), The procedure for DFS is as follow 1. Initially the Stack is empty, and all the vertices are in initial state. 2. PUSH starting vertex into the stack. 3. POP a vertex from stack. 4. If the Popped vertex is in initial state, visit it and change its state to visited 5. PUSH all the unvisited vertex adjacent to the popped vertex. 6. Repeat step 3,4,5 until the stack is empty.
  • 13. Thank You By Prof. Raj Sarode 13