SlideShare a Scribd company logo
2
Most read
4
Most read
Design & Analysis of Algorithm 
Graph Traversal Algorithms 
Kamalesh Karmakar 
Assistant Professor 
Department of C.S.E. 
MeghnadSahaInstitute of Technology 
Kolkata.
Design & Analysis of Algorithm 
Graph Traversal Algorithms
Design & Analysis of Algorithm 
Graph Traversal Algorithms
Design & Analysis of Algorithm 
Graph Traversal Algorithms
Design & Analysis of Algorithm 
Graph Traversal Algorithms
Design & Analysis of Algorithm 
Beforeprovingthevariouspropertiesofbreadth-firstsearch,wetakeonthesomewhateasierjobofanalyzingitsrunningtimeonaninputgraphG=(V,E).Weuseaggregateanalysis,aswesawinSection17.1.Afterinitialization,novertexiseverwhitened,andthusthetestinline13ensuresthateachvertexisenqueuedatmostonce,andhencedequeuedatmostonce.TheoperationsofenqueuinganddequeuingtakeO(1)time,sothetotaltimedevotedtoqueueoperationsisO(V).Becausetheadjacencylistofeachvertexisscannedonlywhenthevertexisdequeued,eachadjacencylistisscannedatmostonce.Sincethesumofthelengthsofalltheadjacencylistsis(E),thetotaltimespentinscanningadjacencylistsisO(E).TheoverheadforinitializationisO(V),andthusthetotalrunningtimeofBFSisO(V+E).Thus,breadth-firstsearchrunsintimelinearinthesizeoftheadjacency-listrepresentationofG. 
Graph Traversal Algorithms
Design & Analysis of Algorithm 
Graph Traversal Algorithms
Design & Analysis of Algorithm 
Graph Traversal Algorithms
Design & Analysis of Algorithm 
Graph Traversal Algorithms
Design & Analysis of Algorithm 
Graph Traversal Algorithms
Design & Analysis of Algorithm 
G. 
Graph Traversal Algorithms
Design & Analysis of Algorithm 
Wecandefinefouredgetypesintermsofthedepth-firstforestGπproducedbyadepth-firstsearchonG. 
1.Treeedgesareedgesinthedepth-firstforestGπ.Edge(u,v)isatreeedgeifvwasfirstdiscoveredbyexploringedge(u,v). 
2.Backedgesarethoseedges(u,v)connectingavertexutoanancestorvinadepth-firsttree.Self-loops,whichmayoccurindirectedgraphs,areconsideredtobebackedges. 
3.Forwardedgesarethosenon-treeedges(u,v)connectingavertexutoadescendantvinadepth-firsttree. 
4.Crossedgesareallotheredges.Theycangobetweenverticesinthesamedepth-firsttree,aslongasonevertexisnotanancestoroftheother,ortheycangobetweenverticesindifferentdepth-firsttrees. 
Graph Traversal Algorithms

More Related Content

PPT
Algorithm Design Presentation
PPT
Fundamental of Algorithms
PDF
Analysis of Algorithms II - PS2
PPTX
Notion of an algorithm
PPTX
#1 designandanalysis of algo
PDF
I don’t care if you have 360 Intra directional predictors
PPTX
Daa unit 1
Algorithm Design Presentation
Fundamental of Algorithms
Analysis of Algorithms II - PS2
Notion of an algorithm
#1 designandanalysis of algo
I don’t care if you have 360 Intra directional predictors
Daa unit 1

What's hot (20)

PPTX
Applied Design Patterns - A Compiler Case Study
PDF
Graph processing - Graphlab
PDF
Graph processing - Powergraph and GraphX
PPT
Model and Design
PDF
Lecture 1 objective and course plan
PDF
Algorithmic problem solving
PDF
An Efficient and Parallel Abstract Interpreter in Scala — Preparatory Work — ...
PDF
Owf 2013 rii alter go speaker 5
PPSX
Ds03 algorithms jyoti lakhani
PDF
ziad_cv
PDF
Design and analysis of algorithms
PPT
Amortized analysis
PPT
Analysis algorithm introduction Lecture# 1
PDF
Algorithms Lecture 1: Introduction to Algorithms
PDF
Doctoral Consortium@RuleML2015: Genetic Programming for Design Grammar Rule I...
PPTX
Asymptotic analysis of parallel programs
PPTX
Evaluation of Expression in Query Processing
PPTX
Instructuion set of 8085
PDF
Lecture 2 role of algorithms in computing
Applied Design Patterns - A Compiler Case Study
Graph processing - Graphlab
Graph processing - Powergraph and GraphX
Model and Design
Lecture 1 objective and course plan
Algorithmic problem solving
An Efficient and Parallel Abstract Interpreter in Scala — Preparatory Work — ...
Owf 2013 rii alter go speaker 5
Ds03 algorithms jyoti lakhani
ziad_cv
Design and analysis of algorithms
Amortized analysis
Analysis algorithm introduction Lecture# 1
Algorithms Lecture 1: Introduction to Algorithms
Doctoral Consortium@RuleML2015: Genetic Programming for Design Grammar Rule I...
Asymptotic analysis of parallel programs
Evaluation of Expression in Query Processing
Instructuion set of 8085
Lecture 2 role of algorithms in computing
Ad

Similar to 08. graph traversal (20)

PDF
Algorithms Lecture 7: Graph Algorithms
PPTX
Introduction-to-Algorithm-Design-and-Analysis.pptx
PDF
1. Introduction to Algorithms, Specification of Algorithm, Complexity.pdf
PDF
Design and Analysis Algorithms.pdf
PDF
DESIGN AND ANALYSIS OF ALGORITHMS by Bharat Sir
PPTX
DESIGN AND ANALYSIS OF ALGORITHMS
PPTX
DAA Lecture on the accountabiltity of DAA
PDF
Cs6402 scad-msm
PPT
DESIGN AND ANALYSIS OF ALGORITHM FULL NOTES
PPTX
Graphtraversals Data Structures and its types. Different types of graphs are ...
PDF
syllabus
PPTX
01-Design and Analysis of Algorithms-Introduction
PPTX
Graphs in Design and Analysis of Algorithms.pptx
PDF
Lec01-Algorithems - Introduction and Overview.pdf
PPTX
Algorithm analysis (All in one)
PPTX
Introduction-to-Algorithms-Concepts-and-Analysis.pptx
PPTX
CSE 443 (1).pptx
PPTX
algorithmanalysisinfundamentalsofdatastructure-190810085243.pptx
PPTX
CH-1.1 Introduction (1).pptx
PDF
Data Structure - Lecture 1 - Introduction.pdf
Algorithms Lecture 7: Graph Algorithms
Introduction-to-Algorithm-Design-and-Analysis.pptx
1. Introduction to Algorithms, Specification of Algorithm, Complexity.pdf
Design and Analysis Algorithms.pdf
DESIGN AND ANALYSIS OF ALGORITHMS by Bharat Sir
DESIGN AND ANALYSIS OF ALGORITHMS
DAA Lecture on the accountabiltity of DAA
Cs6402 scad-msm
DESIGN AND ANALYSIS OF ALGORITHM FULL NOTES
Graphtraversals Data Structures and its types. Different types of graphs are ...
syllabus
01-Design and Analysis of Algorithms-Introduction
Graphs in Design and Analysis of Algorithms.pptx
Lec01-Algorithems - Introduction and Overview.pdf
Algorithm analysis (All in one)
Introduction-to-Algorithms-Concepts-and-Analysis.pptx
CSE 443 (1).pptx
algorithmanalysisinfundamentalsofdatastructure-190810085243.pptx
CH-1.1 Introduction (1).pptx
Data Structure - Lecture 1 - Introduction.pdf
Ad

More from Onkar Nath Sharma (9)

PDF
09. amortized analysis
PDF
07. disjoint set
PDF
06. string matching
PDF
05. greedy method
PDF
04. backtracking
PDF
03. dynamic programming
PDF
02. divide and conquer
PDF
01. design & analysis of agorithm intro & complexity analysis
PDF
Analyzing algorithms
09. amortized analysis
07. disjoint set
06. string matching
05. greedy method
04. backtracking
03. dynamic programming
02. divide and conquer
01. design & analysis of agorithm intro & complexity analysis
Analyzing algorithms

Recently uploaded (20)

PPT
Mechanical Engineering MATERIALS Selection
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
PDF
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
PPTX
additive manufacturing of ss316l using mig welding
PDF
Digital Logic Computer Design lecture notes
PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
PPT
introduction to datamining and warehousing
PDF
PPT on Performance Review to get promotions
PDF
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
PDF
Automation-in-Manufacturing-Chapter-Introduction.pdf
PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
PDF
composite construction of structures.pdf
PPT
Introduction, IoT Design Methodology, Case Study on IoT System for Weather Mo...
PDF
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
PPTX
Current and future trends in Computer Vision.pptx
PPTX
Internet of Things (IOT) - A guide to understanding
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PPTX
Construction Project Organization Group 2.pptx
Mechanical Engineering MATERIALS Selection
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
additive manufacturing of ss316l using mig welding
Digital Logic Computer Design lecture notes
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
introduction to datamining and warehousing
PPT on Performance Review to get promotions
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
Automation-in-Manufacturing-Chapter-Introduction.pdf
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
composite construction of structures.pdf
Introduction, IoT Design Methodology, Case Study on IoT System for Weather Mo...
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
Current and future trends in Computer Vision.pptx
Internet of Things (IOT) - A guide to understanding
Operating System & Kernel Study Guide-1 - converted.pdf
Construction Project Organization Group 2.pptx

08. graph traversal

  • 1. Design & Analysis of Algorithm Graph Traversal Algorithms Kamalesh Karmakar Assistant Professor Department of C.S.E. MeghnadSahaInstitute of Technology Kolkata.
  • 2. Design & Analysis of Algorithm Graph Traversal Algorithms
  • 3. Design & Analysis of Algorithm Graph Traversal Algorithms
  • 4. Design & Analysis of Algorithm Graph Traversal Algorithms
  • 5. Design & Analysis of Algorithm Graph Traversal Algorithms
  • 6. Design & Analysis of Algorithm Beforeprovingthevariouspropertiesofbreadth-firstsearch,wetakeonthesomewhateasierjobofanalyzingitsrunningtimeonaninputgraphG=(V,E).Weuseaggregateanalysis,aswesawinSection17.1.Afterinitialization,novertexiseverwhitened,andthusthetestinline13ensuresthateachvertexisenqueuedatmostonce,andhencedequeuedatmostonce.TheoperationsofenqueuinganddequeuingtakeO(1)time,sothetotaltimedevotedtoqueueoperationsisO(V).Becausetheadjacencylistofeachvertexisscannedonlywhenthevertexisdequeued,eachadjacencylistisscannedatmostonce.Sincethesumofthelengthsofalltheadjacencylistsis(E),thetotaltimespentinscanningadjacencylistsisO(E).TheoverheadforinitializationisO(V),andthusthetotalrunningtimeofBFSisO(V+E).Thus,breadth-firstsearchrunsintimelinearinthesizeoftheadjacency-listrepresentationofG. Graph Traversal Algorithms
  • 7. Design & Analysis of Algorithm Graph Traversal Algorithms
  • 8. Design & Analysis of Algorithm Graph Traversal Algorithms
  • 9. Design & Analysis of Algorithm Graph Traversal Algorithms
  • 10. Design & Analysis of Algorithm Graph Traversal Algorithms
  • 11. Design & Analysis of Algorithm G. Graph Traversal Algorithms
  • 12. Design & Analysis of Algorithm Wecandefinefouredgetypesintermsofthedepth-firstforestGπproducedbyadepth-firstsearchonG. 1.Treeedgesareedgesinthedepth-firstforestGπ.Edge(u,v)isatreeedgeifvwasfirstdiscoveredbyexploringedge(u,v). 2.Backedgesarethoseedges(u,v)connectingavertexutoanancestorvinadepth-firsttree.Self-loops,whichmayoccurindirectedgraphs,areconsideredtobebackedges. 3.Forwardedgesarethosenon-treeedges(u,v)connectingavertexutoadescendantvinadepth-firsttree. 4.Crossedgesareallotheredges.Theycangobetweenverticesinthesamedepth-firsttree,aslongasonevertexisnotanancestoroftheother,ortheycangobetweenverticesindifferentdepth-firsttrees. Graph Traversal Algorithms