SlideShare a Scribd company logo
1 of 23
Bhagwan Mahavir College Of Engineering &Technology
 BHAM RAHELA A (150063131003)
 AGRAVAT DIVYA H (150063131001)
 BODRA BHUMI A (150063131004)
 CHODVADIYA JYOTSNA B (150063131005)
 Traversing a Graph
 Breadth First search(BFS)
 Depth first search(DFS)
 Topological sort
 Connected component
 A graph search (or traversal) technique visits every
node exactly one in a systematic fashion.
 Two standard graph search techniques have been
widely used:
 DFS
 BFS
 In the case of rooted binary trees, three recursive
traversal techniques are widely used:
 InorderTraversal
 PreorderTraversal
 PostorderTraversal
 Can be used to attempt to visit all nodes of a
graph in a systematic manner
 The basic idea behind this algorithm is that it
traverses the graph using recursion
 In DFS, go as far as possible along a single
path until reach a dead end (a vertex with no
edge out or no neighbor unexplored) then
backtrack
DFS-iterative (G, s): //where G is graph and s is source vertex.
let S be stack
S.push( s ) // inserting s in stack
mark s as visited.
while ( S is not empty): // pop a vertex from stack to visit next
v = S.top( )
S.pop( )
//push all the neighbours of v in stack that are not visited
for all neighbours w of v in Graph G:
If w is not visited :
S.push( w )
mark w as visited DFS-recursive(G, s):
mark s as visited
for all neighbours w of s in Graph G:
if w is not visited:
DFS-recursive(G, w)
 In BFS, one explore a graph level by level away (explore all
neighbors first and then move on)
The breath first forest is a collection of a tree in which
the traversal starting vertex serve as a root of first tree.
 Rule 1 −Visit unvisited vertex. Mark it visited.
Display it. Insert it in a queue.
 Rule 2 − If no vertex found, remove the first
vertex from queue.
 Rule 3 − Repeat Rule 1 and Rule 2 until queue
is empty.
BFS (G, s)
//where G is graph and s is source node.
let Q be queue.
Q.enqueue( s )
//inserting s in queue until all its neighbor vertices are marked.
mark s as visited.
while ( Q is not empty)
// removing that vertex from queue, whose neighbor will be visited now.
v = Q.dequeue( )
//processing all the neighbors of v
for all neighbors w of v in Graph G
if w is not visited
Q.enqueue(w)
//stores w in Q to further visit its neighbor
mark w as visited.
node level[ node ] s(source node) 0 1 1 2 1 3 2 4 2 5 2 6 2 7 3node level[ node ] s(source node) 0 1 1 2 1 3 2 4 2 5 2 6 2 7 3node level[ node ] s(source node) 0 1 1 2 1 3 2 4 2 5 2 6 2 7 3node level[ node ] s(source node) 0 1 1 2 1 3 2 4 2 5 2 6 2 7 3
node Level
[ node ]
s(source node) 0
1 1
2 1
3 2
4 2
5 2
6 2
7 3
 Topological sorting of vertices of
a Directed Acyclic Graph is an
ordering of the vertices
v1,v2,...vn in such a way, that if
there is an edge directed
towards vertex vj from vertex vi,
then vi comes before vj
 To understand the sorting with the help of
two algorithm
 DFS based algorithm (using stack)
 Source removal algorithm (removing source)
 Use divide and conquer method
 Find node with no incoming vertex and
remove it with its out going edges(if more
then such vertex then select randomly)
 Note that vertex which is deleted
 All the recorded vertexes gives
topologically sorted list
A topological sorting
of this graph is:
0-1-2-3-4-5
 Articulation point: An Articulation point in a
connected graph is a vertex that, if delete,
would break the graph into two or more
pieces
1
After removing articulation point 1
two disjoint graph
 Biconnected graph: A graph with no
articulation point called biconnected. In
other words, a graph is biconnected if and
only if any vertex is deleted, the graph
remains connected.
 Biconnected component:
A biconnected component of a graph is a
maximal biconnected subgraph- a
biconnected subgraph that is not properly
contained in a larger biconnected
subgraph.
A graph that is not biconnected can divide
into biconnected components, sets of
nodes mutually accessible via two distinct
paths.
 Steps to find articulation points
 The root of the DFS tree is an articulation
point.
 A leaf node of DFS tree is not an articulation
point
 If u is an internal node then it is not
articulation point if and only if from every
child w and u is possible to reach an ancestor
of u using only a pathmade up of descendant
of w and back edge
 www.hackerearth.com
 www.csie.ntu.edu.tw
 www.boost.org
 www.khanacademy.org
Analysis & design of algorithm

More Related Content

What's hot

Breadth First Search (BFS)
Breadth First Search (BFS)Breadth First Search (BFS)
Breadth First Search (BFS)Dhrumil Panchal
 
Breadth first search (Bfs)
Breadth first search (Bfs)Breadth first search (Bfs)
Breadth first search (Bfs)Ishucs
 
Topological Sort and BFS
Topological Sort and BFSTopological Sort and BFS
Topological Sort and BFSArchanaMani2
 
Directed Acyclic Graph
Directed Acyclic Graph Directed Acyclic Graph
Directed Acyclic Graph AJAL A J
 
Depth First Search and Breadth First Search
Depth First Search and Breadth First SearchDepth First Search and Breadth First Search
Depth First Search and Breadth First SearchBenjamin Sach
 
Breadth first search and depth first search
Breadth first search and  depth first searchBreadth first search and  depth first search
Breadth first search and depth first searchHossain Md Shakhawat
 
Application Of Graph Data Structure
Application Of Graph Data StructureApplication Of Graph Data Structure
Application Of Graph Data StructureGaurang Dobariya
 
Skiena algorithm 2007 lecture12 topological sort connectivity
Skiena algorithm 2007 lecture12 topological sort connectivitySkiena algorithm 2007 lecture12 topological sort connectivity
Skiena algorithm 2007 lecture12 topological sort connectivityzukun
 
Graph Algorithms
Graph AlgorithmsGraph Algorithms
Graph AlgorithmsAshwin Shiv
 

What's hot (20)

Data Structures - Lecture 10 [Graphs]
Data Structures - Lecture 10 [Graphs]Data Structures - Lecture 10 [Graphs]
Data Structures - Lecture 10 [Graphs]
 
Bfs and Dfs
Bfs and DfsBfs and Dfs
Bfs and Dfs
 
Graphs
GraphsGraphs
Graphs
 
Graphs bfs dfs
Graphs bfs dfsGraphs bfs dfs
Graphs bfs dfs
 
Breadth First Search (BFS)
Breadth First Search (BFS)Breadth First Search (BFS)
Breadth First Search (BFS)
 
Breadth first search (Bfs)
Breadth first search (Bfs)Breadth first search (Bfs)
Breadth first search (Bfs)
 
Breadth first search
Breadth first searchBreadth first search
Breadth first search
 
BFS
BFSBFS
BFS
 
Data structure note
Data structure noteData structure note
Data structure note
 
Topological Sort
Topological SortTopological Sort
Topological Sort
 
Topological Sort and BFS
Topological Sort and BFSTopological Sort and BFS
Topological Sort and BFS
 
Directed Acyclic Graph
Directed Acyclic Graph Directed Acyclic Graph
Directed Acyclic Graph
 
Depth First Search and Breadth First Search
Depth First Search and Breadth First SearchDepth First Search and Breadth First Search
Depth First Search and Breadth First Search
 
Breadth first search and depth first search
Breadth first search and  depth first searchBreadth first search and  depth first search
Breadth first search and depth first search
 
Application Of Graph Data Structure
Application Of Graph Data StructureApplication Of Graph Data Structure
Application Of Graph Data Structure
 
Skiena algorithm 2007 lecture12 topological sort connectivity
Skiena algorithm 2007 lecture12 topological sort connectivitySkiena algorithm 2007 lecture12 topological sort connectivity
Skiena algorithm 2007 lecture12 topological sort connectivity
 
Data structure
Data structureData structure
Data structure
 
Shortest path algorithm
Shortest  path algorithmShortest  path algorithm
Shortest path algorithm
 
Data structure and algorithm
Data structure and algorithmData structure and algorithm
Data structure and algorithm
 
Graph Algorithms
Graph AlgorithmsGraph Algorithms
Graph Algorithms
 

Viewers also liked

Introduction
IntroductionIntroduction
Introductionpilavare
 
Design and Analysis of algorithms
Design and Analysis of algorithmsDesign and Analysis of algorithms
Design and Analysis of algorithmsDr. Rupa Ch
 
design and analysis of algorithm
design and analysis of algorithmdesign and analysis of algorithm
design and analysis of algorithmMuhammad Arish
 
QUESTION BANK FOR ANNA UNNIVERISTY SYLLABUS
QUESTION BANK FOR ANNA UNNIVERISTY SYLLABUSQUESTION BANK FOR ANNA UNNIVERISTY SYLLABUS
QUESTION BANK FOR ANNA UNNIVERISTY SYLLABUSJAMBIKA
 
Algorithm Analysis and Design Class Notes
Algorithm Analysis and Design Class NotesAlgorithm Analysis and Design Class Notes
Algorithm Analysis and Design Class NotesKumar Avinash
 
Design and Analysis of Algorithms
Design and Analysis of AlgorithmsDesign and Analysis of Algorithms
Design and Analysis of AlgorithmsSwapnil Agrawal
 
Parallel algorithms
Parallel algorithmsParallel algorithms
Parallel algorithmsDanish Javed
 

Viewers also liked (10)

Introduction
IntroductionIntroduction
Introduction
 
Algorithms Question bank
Algorithms Question bankAlgorithms Question bank
Algorithms Question bank
 
Design and Analysis of algorithms
Design and Analysis of algorithmsDesign and Analysis of algorithms
Design and Analysis of algorithms
 
design and analysis of algorithm
design and analysis of algorithmdesign and analysis of algorithm
design and analysis of algorithm
 
QUESTION BANK FOR ANNA UNNIVERISTY SYLLABUS
QUESTION BANK FOR ANNA UNNIVERISTY SYLLABUSQUESTION BANK FOR ANNA UNNIVERISTY SYLLABUS
QUESTION BANK FOR ANNA UNNIVERISTY SYLLABUS
 
DESIGN AND ANALYSIS OF ALGORITHM (DAA)
DESIGN AND ANALYSIS OF ALGORITHM (DAA)DESIGN AND ANALYSIS OF ALGORITHM (DAA)
DESIGN AND ANALYSIS OF ALGORITHM (DAA)
 
Algorithm Analysis and Design Class Notes
Algorithm Analysis and Design Class NotesAlgorithm Analysis and Design Class Notes
Algorithm Analysis and Design Class Notes
 
Design & Analysis Of Algorithm
Design & Analysis Of AlgorithmDesign & Analysis Of Algorithm
Design & Analysis Of Algorithm
 
Design and Analysis of Algorithms
Design and Analysis of AlgorithmsDesign and Analysis of Algorithms
Design and Analysis of Algorithms
 
Parallel algorithms
Parallel algorithmsParallel algorithms
Parallel algorithms
 

Similar to Analysis & design of algorithm

Unit II_Graph.pptxkgjrekjgiojtoiejhgnltegjte
Unit II_Graph.pptxkgjrekjgiojtoiejhgnltegjteUnit II_Graph.pptxkgjrekjgiojtoiejhgnltegjte
Unit II_Graph.pptxkgjrekjgiojtoiejhgnltegjtepournima055
 
Graph Traversal Algorithms - Depth First Search Traversal
Graph Traversal Algorithms - Depth First Search TraversalGraph Traversal Algorithms - Depth First Search Traversal
Graph Traversal Algorithms - Depth First Search TraversalAmrinder Arora
 
Analysis of Pathfinding Algorithms
Analysis of Pathfinding AlgorithmsAnalysis of Pathfinding Algorithms
Analysis of Pathfinding AlgorithmsSigSegVSquad
 
Unit-6 Graph.ppsx ppt
Unit-6 Graph.ppsx                                       pptUnit-6 Graph.ppsx                                       ppt
Unit-6 Graph.ppsx pptDhruvilSTATUS
 
Graph in data structure
Graph in data structureGraph in data structure
Graph in data structurePooja Bhojwani
 
Graphs in data structures
Graphs in data structuresGraphs in data structures
Graphs in data structuresSavit Chandra
 
Graph_data_structure_information_engineering.pptx
Graph_data_structure_information_engineering.pptxGraph_data_structure_information_engineering.pptx
Graph_data_structure_information_engineering.pptxsahilpawar2426
 
2.5 bfs & dfs 02
2.5 bfs & dfs 022.5 bfs & dfs 02
2.5 bfs & dfs 02Krish_ver2
 
NON-LINEAR DATA STRUCTURE-Graphs.pptx
NON-LINEAR DATA STRUCTURE-Graphs.pptxNON-LINEAR DATA STRUCTURE-Graphs.pptx
NON-LINEAR DATA STRUCTURE-Graphs.pptxRajitha Reddy Alugati
 
Graph Traversals
Graph TraversalsGraph Traversals
Graph TraversalsMaryJacob24
 
Unit 3 graph chapter6
Unit 3  graph chapter6Unit 3  graph chapter6
Unit 3 graph chapter6DrkhanchanaR
 
Graph Data Structure
Graph Data StructureGraph Data Structure
Graph Data StructureKeno benti
 

Similar to Analysis & design of algorithm (20)

Graphs
GraphsGraphs
Graphs
 
Unit II_Graph.pptxkgjrekjgiojtoiejhgnltegjte
Unit II_Graph.pptxkgjrekjgiojtoiejhgnltegjteUnit II_Graph.pptxkgjrekjgiojtoiejhgnltegjte
Unit II_Graph.pptxkgjrekjgiojtoiejhgnltegjte
 
Strongly connected components
Strongly connected componentsStrongly connected components
Strongly connected components
 
DATA STRUCTURES.pptx
DATA STRUCTURES.pptxDATA STRUCTURES.pptx
DATA STRUCTURES.pptx
 
logic.pptx
logic.pptxlogic.pptx
logic.pptx
 
Graph Traversal Algorithms - Depth First Search Traversal
Graph Traversal Algorithms - Depth First Search TraversalGraph Traversal Algorithms - Depth First Search Traversal
Graph Traversal Algorithms - Depth First Search Traversal
 
U1 L5 DAA.pdf
U1 L5 DAA.pdfU1 L5 DAA.pdf
U1 L5 DAA.pdf
 
Analysis of Pathfinding Algorithms
Analysis of Pathfinding AlgorithmsAnalysis of Pathfinding Algorithms
Analysis of Pathfinding Algorithms
 
Unit-6 Graph.ppsx ppt
Unit-6 Graph.ppsx                                       pptUnit-6 Graph.ppsx                                       ppt
Unit-6 Graph.ppsx ppt
 
Graph in data structure
Graph in data structureGraph in data structure
Graph in data structure
 
Graphs in data structures
Graphs in data structuresGraphs in data structures
Graphs in data structures
 
Graph_data_structure_information_engineering.pptx
Graph_data_structure_information_engineering.pptxGraph_data_structure_information_engineering.pptx
Graph_data_structure_information_engineering.pptx
 
Daa chpater 12
Daa chpater 12Daa chpater 12
Daa chpater 12
 
2.5 bfs & dfs 02
2.5 bfs & dfs 022.5 bfs & dfs 02
2.5 bfs & dfs 02
 
NON-LINEAR DATA STRUCTURE-Graphs.pptx
NON-LINEAR DATA STRUCTURE-Graphs.pptxNON-LINEAR DATA STRUCTURE-Graphs.pptx
NON-LINEAR DATA STRUCTURE-Graphs.pptx
 
Graph Traversals
Graph TraversalsGraph Traversals
Graph Traversals
 
Unit 3 graph chapter6
Unit 3  graph chapter6Unit 3  graph chapter6
Unit 3 graph chapter6
 
LEC 12-DSALGO-GRAPHS(final12).pdf
LEC 12-DSALGO-GRAPHS(final12).pdfLEC 12-DSALGO-GRAPHS(final12).pdf
LEC 12-DSALGO-GRAPHS(final12).pdf
 
Graph Data Structure
Graph Data StructureGraph Data Structure
Graph Data Structure
 
Unit 9 graph
Unit   9 graphUnit   9 graph
Unit 9 graph
 

Recently uploaded

CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfAsst.prof M.Gokilavani
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AIabhishek36461
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfAsst.prof M.Gokilavani
 
complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...asadnawaz62
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxDeepakSakkari2
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerAnamika Sarkar
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...VICTOR MAESTRE RAMIREZ
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidNikhilNagaraju
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...srsj9000
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxwendy cai
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfme23b1001
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineeringmalavadedarshan25
 
power system scada applications and uses
power system scada applications and usespower system scada applications and uses
power system scada applications and usesDevarapalliHaritha
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girlsssuser7cb4ff
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxKartikeyaDwivedi3
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024Mark Billinghurst
 

Recently uploaded (20)

CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AI
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
 
complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptx
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfid
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
 
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptx
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdf
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineering
 
power system scada applications and uses
power system scada applications and usespower system scada applications and uses
power system scada applications and uses
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girls
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptx
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024
 

Analysis & design of algorithm

  • 1. Bhagwan Mahavir College Of Engineering &Technology
  • 2.  BHAM RAHELA A (150063131003)  AGRAVAT DIVYA H (150063131001)  BODRA BHUMI A (150063131004)  CHODVADIYA JYOTSNA B (150063131005)
  • 3.  Traversing a Graph  Breadth First search(BFS)  Depth first search(DFS)  Topological sort  Connected component
  • 4.  A graph search (or traversal) technique visits every node exactly one in a systematic fashion.  Two standard graph search techniques have been widely used:  DFS  BFS  In the case of rooted binary trees, three recursive traversal techniques are widely used:  InorderTraversal  PreorderTraversal  PostorderTraversal
  • 5.  Can be used to attempt to visit all nodes of a graph in a systematic manner  The basic idea behind this algorithm is that it traverses the graph using recursion  In DFS, go as far as possible along a single path until reach a dead end (a vertex with no edge out or no neighbor unexplored) then backtrack
  • 6. DFS-iterative (G, s): //where G is graph and s is source vertex. let S be stack S.push( s ) // inserting s in stack mark s as visited. while ( S is not empty): // pop a vertex from stack to visit next v = S.top( ) S.pop( ) //push all the neighbours of v in stack that are not visited for all neighbours w of v in Graph G: If w is not visited : S.push( w ) mark w as visited DFS-recursive(G, s): mark s as visited for all neighbours w of s in Graph G: if w is not visited: DFS-recursive(G, w)
  • 7.
  • 8.  In BFS, one explore a graph level by level away (explore all neighbors first and then move on) The breath first forest is a collection of a tree in which the traversal starting vertex serve as a root of first tree.  Rule 1 −Visit unvisited vertex. Mark it visited. Display it. Insert it in a queue.  Rule 2 − If no vertex found, remove the first vertex from queue.  Rule 3 − Repeat Rule 1 and Rule 2 until queue is empty.
  • 9. BFS (G, s) //where G is graph and s is source node. let Q be queue. Q.enqueue( s ) //inserting s in queue until all its neighbor vertices are marked. mark s as visited. while ( Q is not empty) // removing that vertex from queue, whose neighbor will be visited now. v = Q.dequeue( ) //processing all the neighbors of v for all neighbors w of v in Graph G if w is not visited Q.enqueue(w) //stores w in Q to further visit its neighbor mark w as visited.
  • 10.
  • 11. node level[ node ] s(source node) 0 1 1 2 1 3 2 4 2 5 2 6 2 7 3node level[ node ] s(source node) 0 1 1 2 1 3 2 4 2 5 2 6 2 7 3node level[ node ] s(source node) 0 1 1 2 1 3 2 4 2 5 2 6 2 7 3node level[ node ] s(source node) 0 1 1 2 1 3 2 4 2 5 2 6 2 7 3 node Level [ node ] s(source node) 0 1 1 2 1 3 2 4 2 5 2 6 2 7 3
  • 12.  Topological sorting of vertices of a Directed Acyclic Graph is an ordering of the vertices v1,v2,...vn in such a way, that if there is an edge directed towards vertex vj from vertex vi, then vi comes before vj
  • 13.  To understand the sorting with the help of two algorithm  DFS based algorithm (using stack)  Source removal algorithm (removing source)  Use divide and conquer method
  • 14.  Find node with no incoming vertex and remove it with its out going edges(if more then such vertex then select randomly)  Note that vertex which is deleted  All the recorded vertexes gives topologically sorted list
  • 15.
  • 16. A topological sorting of this graph is: 0-1-2-3-4-5
  • 17.  Articulation point: An Articulation point in a connected graph is a vertex that, if delete, would break the graph into two or more pieces
  • 18. 1 After removing articulation point 1 two disjoint graph
  • 19.  Biconnected graph: A graph with no articulation point called biconnected. In other words, a graph is biconnected if and only if any vertex is deleted, the graph remains connected.
  • 20.  Biconnected component: A biconnected component of a graph is a maximal biconnected subgraph- a biconnected subgraph that is not properly contained in a larger biconnected subgraph. A graph that is not biconnected can divide into biconnected components, sets of nodes mutually accessible via two distinct paths.
  • 21.  Steps to find articulation points  The root of the DFS tree is an articulation point.  A leaf node of DFS tree is not an articulation point  If u is an internal node then it is not articulation point if and only if from every child w and u is possible to reach an ancestor of u using only a pathmade up of descendant of w and back edge
  • 22.  www.hackerearth.com  www.csie.ntu.edu.tw  www.boost.org  www.khanacademy.org