SlideShare a Scribd company logo
1 of 26
Design and
Analysis of
Algorithms
GRAPH TRAVERSAL
TECHNIQUES
 Instructor
Prof. Amrinder Arora
amrinder@gwu.edu
Please copy TA on emails
Please feel free to call as well

 Available for study sessions
Science and Engineering Hall
GWU
Algorithms Graph Traversal Techniques 2
LOGISTICS
Algorithms
Analysis
Asymptotic
NP-
Completeness
Design
D&C
Greedy
DP
Graph
B&B
Applications
Algorithms Graph Traversal Techniques 3
WHERE WE ARE
 Done
 Done
 Starting..
 Done
 Done
Suppose you have two jugs, one capable of holding 5
cups, and one capable of holding 8 cups.
[The jugs are irregularly shaped and without
markings, so you can't determine how much water is
in either jug unless it is completely full or completely
empty.]
You also have a faucet, and as much water as you'd
like.
Can you get 3 cups?
Can you obtain 1 cup? 2 cups? 4 cups? 6 cups? 7
cups?
Algorithms Graph Traversal Techniques 4
PUZZLES
Where can we go from here:
(x,y) 
a. (0,y) / (x,0)  Empty first/second
b. (5,y) / (x,8)  Fill first/second
c. (5,x+y-5)  Second to First, x+y > 5
d. (x+y,0)  Second to First
e. (x+y-8,8)  First to Second, x+y > 8
f. (0,x+y)  First to Second
Algorithms Graph Traversal Techniques 5
PUZZLES (CONT.)
(0,0)
1. (0,8) // b
2. (5,3) // c
3. (0,3) // a
4. (3,0) // d
5. (3,8) // a
6. (5,6) // c
7. (0,6) // a
8. (5,1) // c
9. (0,1) // a
Algorithms Graph Traversal Techniques 6
PUZZLES (CONT.)
While ()
 Make a transition step
 Reach a new state
 If new state is what you were looking for  “Eureka Eureka”
This also works if trying to change state in life
 [Or in the US.]
Algorithms Graph Traversal Techniques 7
POSSIBLE SOLUTION
A graph search (or traversal) technique visits every
node exactly once in a systematic fashion.
 Basic use case is the search
Two basic techniques:
 Depth-First Search (DFS)
 Breadth-First Search (BFS)
Algorithms Graph Traversal Techniques 8
GRAPH TRAVERSAL TECHNIQUES
Algorithms Graph Traversal Techniques 9
AMAZING WHAT PROBLEMS WE CAN
SOLVE USING TRAVERSAL TECHNIQUES
Edges of input graph G = (V,E) can be classified
in context of the forest G’ produced by the
traversal of G
Tree edges (aka Discovery Edge): Edge (u,v) if v first
discovered by exploring edge (u,v)
Back edges: Edge (u,v) connecting a vertex u to an
ancestor v. Self loops are also back edges.
Forward edge: Edge (u,v) connecting a vertex u to a
descendent v.
Cross edges: All other edges
Algorithms Graph Traversal Techniques 10
CLASSIFICATION OF EDGES
1) DFS follows the following rules: Select an unvisited
node s, visit it, and treat as the current node
2) Find an unvisited neighbor of the current node, visit it,
and make it the new current node;
3) If the current node has no unvisited neighbors,
backtrack to the its parent, and make that the new
current node
Repeat the steps 2 and 3 until no more nodes can be
visited.
4) If there are still unvisited nodes, repeat from step 1.
[Use of backtracking suggests that a stack is a good
data structure for DFS implementation]
Algorithms Graph Traversal Techniques 11
DEPTH FIRST SEARCH (DFS)
Procedure DFS(input: graph G)
Stack T; Integer s,x;
while (G has an unvisited node) do
s := an unvisited node
visit(v)
T.push(v)
while (T is not empty) do
x := T.top()
if (x has an unvisited neighbor y) then
visit(y)
T.push(y)
else
T.pop()
endif
endwhile
endwhile
Algorithms Graph Traversal Techniques 12
DFS IMPLEMENTATION
dfs (Graph G) {
// all vertices of G are first painted white
while there is a white node in G {
dfs-visit(G, u)
}
}
dfs-visit (Graph G, Vertex u) {
the vertex u is painted gray
u.d = time++ // u has now been discovered
for all white successors v of u {
dfs-visit(G, v)
}
u is painted black
u.f = time++ // Exploration of u has finished
}
Algorithms Graph Traversal Techniques 13
DFS – ALTERNATE ALGORITHMIC VIEW
https://www.cs.usfca.edu/~galles/visualization/DFS.html
 For undirected graphs:
 http://www.algolist.net/Algorithms/Graph/Undirected/Depth-
first_search
 For directed graphs:
 http://www.cs.duke.edu/csed/jawaa2/examples/DFS.html
Algorithms Graph Traversal Techniques 14
DFS ANIMATION
 Every node is visited once. Also, every edge (x,y) is
"crossed" twice: one time when node y is checked
from x to see if it is visited (if not visited, then y
would be visited from x), and another time, when we
back track from y to x.
 Therefore, the time of DFS is O(n+|E|), or O(n+m)
 If the graph is connected, the time is O(m) because
the graph has at least n-1 edges, and so n+m <= 2m
+1, implying that n+m is O(m).
Algorithms Graph Traversal Techniques 15
DFS TIME COMPLEXITY
 If the start of node u is marked as “(u”, and the end
as “u)”, then the overall parenthetical expression is
well-formed. For example: (u (v (z z) (w w) v) u)
 Proof: Immediate from the recursive nature of the
algorithm
 dfs-visit(u)
 u.d  This gets logged as “(u”
 Recursive calls to dfs-visit of other nodes
 u.f  This gets logged as “u)”
 In other words: [d,f] intervals are properly nested
Algorithms Graph Traversal Techniques 16
PARENTHESIS THEOREM
 Theorem: In DFS, every edge of undirected graph G is
either a tree edge or a back edge. (In other words, no
forward or cross edges exist in G’ produced by DFS
traversal of G).
(Theorem – book section 7.2.3.)
 Discussion Points:
 Can a “forward” edge exist in DFS traversal?
 Can a “cross” edge exist in DFS traversal?
 Let (x,y) be a cross edge, that is, x and y are in separate subtrees of
the DFS tree. Assume x was visited before y.
 When a search for unvisited neighbors of x was conducted and none
found, x was backtracked from, never to return to x again.
 Why did we skip y at that time?
 Since y is a neighbor of x and y is not visited at time t, y would have to be visited from x
before the algorithm backtracks from x. That would make y a descendent of x.
Contradiction.
 Therefore, no such cross edge (x,y) can exist in a DFS tree.
Algorithms Graph Traversal Techniques 17
DFS EDGE CLASSIFICATION THEOREM
 Use a counter to count the number of time the outer while-
loop iterates in the DFS algorithm, the counter value at the
end will be equal to the number of connected components of
the input graph G.
 This is because the body of the outer loop, that is, every
iteration, fully traverses the connected component that
contains the node v.
 If the counter value is 1, then the graph is connected. That is,
the DFS algorithm becomes a connectedness-testing
algorithm that tells if a graph is connected, in O(n+|E|) time
 If the counter value is > 1, the algorithm will indicate that the
graph is disconnected, and the nodes visited in each iteration
constitute a separate connected component. In other terms,
the DFS algorithm identifies the various connected
components.
Algorithms Graph Traversal Techniques 18
FIRST APPLICATION OF DFS: CONNECTIVITY
 Given: A uniformly weighted graph (all edges have weight
w = 1)
 In that case, all spanning trees are of the same weight
(because all trees of n nodes have exactly n-1 edges)
 Thus, to find a minimum spanning tree in such graphs, it
suffices to find any spanning tree.
 DFS yields a spanning tree (if the input graph is
connected, otherwise, it is a spanning forest). That tree is
then a minimum spanning tree. The time to compute the
tree is O(|E|), which is better than the O(|E| log |E|)
time MST algorithm for general weighted graphs.
Algorithms Graph Traversal Techniques 19
SECOND APPLICATION OF DFS: MINIMUM
SPANNING TREES IN UNIFORMLY WEIGHTED
GRAPHS
 Definition: A node in a connected graph is called an
“articulation point” if the deletion of that node
disconnects the graph.
 Definition: A connected graph is called biconnected if
it has no articulation points. That is, the deletion of
any single node leaves the graph connected.
 In the case of networks, an articulation point is referred to as a
single point of failure.
 The Biconnectivity Problem:
 Input: a connected graph G
 Problem: Determine whether or not the graph is biconnected.
If not biconnected, find all the articulation points.
Algorithms Graph Traversal Techniques 20
THIRD APPLICATION OF DFS:
BICONNECTIVITY
 Not biconnected – node G is an articulation point
(single point of failure)
 If there was one more edge, say between E and L,
then G would not be an articulation point.
Algorithms Graph Traversal Techniques 21
EXAMPLE
 Observation: A non-root node x is an articulation
point if and only if x has a subtree from which no
backward edge originates and ends at a proper
ancestor of x.
 Each node i will have two new labels: DFN[i] and L[i].
 DFN[i] ::= sequence in which i is visited. Thus, the first node
visited (i.e., the root) has its DFN = 1. The second node visited
has a DFN = 2, and so on.
 L[i] ::= Lowest DFN number of node which can be reached from
node i using zero or more tree edges, and then a single back
edge; or DFN[i], whichever is lower
Algorithms Graph Traversal Techniques 22
BICONNECTIVITY (CONT.)
 Computing DFN[i] and L[i]
 The DFNs are easy to compute using a simple counter.
 We note that
L[x]=min{
DFN[x],
{DFN[y] | (x,y) is a back edge},
{L[w] | for each child w of x}
}
Algorithms Graph Traversal Techniques 23
BICONNECTIVITY (CONT.)
Algorithms Graph Traversal Techniques 24
Procedure DFS(input: graph G,)
Stack T; Integer num = 1; Integer DFN[1:n], L[1:n], Parent[1:n]
Node s := an unvisited node
visit(s), T.push(s), DFN[s] := num++, L[s] := DFN[s]
While (T is not empty) do
Node x := top(T)
if (x has an unvisited neighbor y) then
visit(y), T.push(y), DFN[y] := num++, Parent[y] := x, L[y] :=
DFN[y]
Else
pop(T)
for (every neighbor y of x) do
if (y != parent[x] and DFN[y] < DFN[x]) then
/* y is an ancestor of x, and (x,y) is a back edge*/
L[x] := min(L[x],DFN[y])
Else
if (x = Parent[y]) then
L[x] : min(L[x],L[y])
if (L[y] >= DFN[x] and x is not root) then x is an
articulation point
if (s has more than one child) then s is an articulation point
DFSBICONNECTIVITY
 Wikipedia link on DFS
Algorithms Graph Traversal Techniques 25
READING / EXTERNAL LINKS
Algorithms
Analysis
Asymptotic
NP-
Completeness
Design
D&C
Greedy
DP
Graph
B&B
Applications
Algorithms Graph Traversal Techniques 26
WHERE WE ARE
 Done
 Done
 Started today..
 Done
 Done

More Related Content

What's hot

Cs6402 design and analysis of algorithms may june 2016 answer key
Cs6402 design and analysis of algorithms may june 2016 answer keyCs6402 design and analysis of algorithms may june 2016 answer key
Cs6402 design and analysis of algorithms may june 2016 answer keyappasami
 
All pairs shortest path algorithm
All pairs shortest path algorithmAll pairs shortest path algorithm
All pairs shortest path algorithmSrikrishnan Suresh
 
Dynamic Programming - Part II
Dynamic Programming - Part IIDynamic Programming - Part II
Dynamic Programming - Part IIAmrinder Arora
 
Divide and Conquer - Part II - Quickselect and Closest Pair of Points
Divide and Conquer - Part II - Quickselect and Closest Pair of PointsDivide and Conquer - Part II - Quickselect and Closest Pair of Points
Divide and Conquer - Part II - Quickselect and Closest Pair of PointsAmrinder Arora
 
DESIGN AND ANALYSIS OF ALGORITHMS
DESIGN AND ANALYSIS OF ALGORITHMSDESIGN AND ANALYSIS OF ALGORITHMS
DESIGN AND ANALYSIS OF ALGORITHMSGayathri Gaayu
 
Branch and bound technique
Branch and bound techniqueBranch and bound technique
Branch and bound techniqueishmecse13
 
Skiena algorithm 2007 lecture16 introduction to dynamic programming
Skiena algorithm 2007 lecture16 introduction to dynamic programmingSkiena algorithm 2007 lecture16 introduction to dynamic programming
Skiena algorithm 2007 lecture16 introduction to dynamic programmingzukun
 
Branch and bound technique
Branch and bound techniqueBranch and bound technique
Branch and bound techniqueishmecse13
 
Basic terminologies & asymptotic notations
Basic terminologies & asymptotic notationsBasic terminologies & asymptotic notations
Basic terminologies & asymptotic notationsRajendran
 
Algorithms Lecture 7: Graph Algorithms
Algorithms Lecture 7: Graph AlgorithmsAlgorithms Lecture 7: Graph Algorithms
Algorithms Lecture 7: Graph AlgorithmsMohamed Loey
 
Euclid's Algorithm for Greatest Common Divisor - Time Complexity Analysis
Euclid's Algorithm for Greatest Common Divisor - Time Complexity AnalysisEuclid's Algorithm for Greatest Common Divisor - Time Complexity Analysis
Euclid's Algorithm for Greatest Common Divisor - Time Complexity AnalysisAmrinder Arora
 

What's hot (20)

NP-Completeness - II
NP-Completeness - IINP-Completeness - II
NP-Completeness - II
 
Cs6402 design and analysis of algorithms may june 2016 answer key
Cs6402 design and analysis of algorithms may june 2016 answer keyCs6402 design and analysis of algorithms may june 2016 answer key
Cs6402 design and analysis of algorithms may june 2016 answer key
 
All pairs shortest path algorithm
All pairs shortest path algorithmAll pairs shortest path algorithm
All pairs shortest path algorithm
 
18 Basic Graph Algorithms
18 Basic Graph Algorithms18 Basic Graph Algorithms
18 Basic Graph Algorithms
 
Dynamic Programming - Part II
Dynamic Programming - Part IIDynamic Programming - Part II
Dynamic Programming - Part II
 
Branch and bound
Branch and boundBranch and bound
Branch and bound
 
Divide and Conquer - Part II - Quickselect and Closest Pair of Points
Divide and Conquer - Part II - Quickselect and Closest Pair of PointsDivide and Conquer - Part II - Quickselect and Closest Pair of Points
Divide and Conquer - Part II - Quickselect and Closest Pair of Points
 
DESIGN AND ANALYSIS OF ALGORITHMS
DESIGN AND ANALYSIS OF ALGORITHMSDESIGN AND ANALYSIS OF ALGORITHMS
DESIGN AND ANALYSIS OF ALGORITHMS
 
Branch and bound technique
Branch and bound techniqueBranch and bound technique
Branch and bound technique
 
Np cooks theorem
Np cooks theoremNp cooks theorem
Np cooks theorem
 
Skiena algorithm 2007 lecture16 introduction to dynamic programming
Skiena algorithm 2007 lecture16 introduction to dynamic programmingSkiena algorithm 2007 lecture16 introduction to dynamic programming
Skiena algorithm 2007 lecture16 introduction to dynamic programming
 
Lecture26
Lecture26Lecture26
Lecture26
 
Assignment 2 daa
Assignment 2 daaAssignment 2 daa
Assignment 2 daa
 
Branch and bound technique
Branch and bound techniqueBranch and bound technique
Branch and bound technique
 
Basic terminologies & asymptotic notations
Basic terminologies & asymptotic notationsBasic terminologies & asymptotic notations
Basic terminologies & asymptotic notations
 
Algorithms Lecture 7: Graph Algorithms
Algorithms Lecture 7: Graph AlgorithmsAlgorithms Lecture 7: Graph Algorithms
Algorithms Lecture 7: Graph Algorithms
 
Euclid's Algorithm for Greatest Common Divisor - Time Complexity Analysis
Euclid's Algorithm for Greatest Common Divisor - Time Complexity AnalysisEuclid's Algorithm for Greatest Common Divisor - Time Complexity Analysis
Euclid's Algorithm for Greatest Common Divisor - Time Complexity Analysis
 
Branch and bound
Branch and boundBranch and bound
Branch and bound
 
1535 graph algorithms
1535 graph algorithms1535 graph algorithms
1535 graph algorithms
 
Unit 2
Unit 2Unit 2
Unit 2
 

Similar to Graph Traversal Algorithms - Depth First Search Traversal

graphin-c1.pnggraphin-c1.txt1 22 3 83 44 5.docx
graphin-c1.pnggraphin-c1.txt1 22 3 83 44 5.docxgraphin-c1.pnggraphin-c1.txt1 22 3 83 44 5.docx
graphin-c1.pnggraphin-c1.txt1 22 3 83 44 5.docxwhittemorelucilla
 
lecture 17
lecture 17lecture 17
lecture 17sajinsc
 
Analysis of Pathfinding Algorithms
Analysis of Pathfinding AlgorithmsAnalysis of Pathfinding Algorithms
Analysis of Pathfinding AlgorithmsSigSegVSquad
 
Algorithm Design and Complexity - Course 8
Algorithm Design and Complexity - Course 8Algorithm Design and Complexity - Course 8
Algorithm Design and Complexity - Course 8Traian Rebedea
 
Analysis &amp; design of algorithm
Analysis &amp; design of algorithmAnalysis &amp; design of algorithm
Analysis &amp; design of algorithmrahela bham
 
Analysis and design of algorithms part 3
Analysis and design of algorithms part 3Analysis and design of algorithms part 3
Analysis and design of algorithms part 3Deepak John
 
Lecture 16 - Dijkstra's Algorithm.pdf
Lecture 16 - Dijkstra's Algorithm.pdfLecture 16 - Dijkstra's Algorithm.pdf
Lecture 16 - Dijkstra's Algorithm.pdfiftakhar8
 
04 greedyalgorithmsii 2x2
04 greedyalgorithmsii 2x204 greedyalgorithmsii 2x2
04 greedyalgorithmsii 2x2MuradAmn
 
Unit II_Graph.pptxkgjrekjgiojtoiejhgnltegjte
Unit II_Graph.pptxkgjrekjgiojtoiejhgnltegjteUnit II_Graph.pptxkgjrekjgiojtoiejhgnltegjte
Unit II_Graph.pptxkgjrekjgiojtoiejhgnltegjtepournima055
 

Similar to Graph Traversal Algorithms - Depth First Search Traversal (20)

graphin-c1.pnggraphin-c1.txt1 22 3 83 44 5.docx
graphin-c1.pnggraphin-c1.txt1 22 3 83 44 5.docxgraphin-c1.pnggraphin-c1.txt1 22 3 83 44 5.docx
graphin-c1.pnggraphin-c1.txt1 22 3 83 44 5.docx
 
Graphs
GraphsGraphs
Graphs
 
Chapter 23 aoa
Chapter 23 aoaChapter 23 aoa
Chapter 23 aoa
 
Graphs in Data Structure
Graphs in Data StructureGraphs in Data Structure
Graphs in Data Structure
 
lecture 17
lecture 17lecture 17
lecture 17
 
Data structure and algorithm
Data structure and algorithmData structure and algorithm
Data structure and algorithm
 
Analysis of Pathfinding Algorithms
Analysis of Pathfinding AlgorithmsAnalysis of Pathfinding Algorithms
Analysis of Pathfinding Algorithms
 
Algorithm Design and Complexity - Course 8
Algorithm Design and Complexity - Course 8Algorithm Design and Complexity - Course 8
Algorithm Design and Complexity - Course 8
 
Bfs dfs
Bfs dfsBfs dfs
Bfs dfs
 
DATA STRUCTURES.pptx
DATA STRUCTURES.pptxDATA STRUCTURES.pptx
DATA STRUCTURES.pptx
 
Unit ii-ppt
Unit ii-pptUnit ii-ppt
Unit ii-ppt
 
Unit 9 graph
Unit   9 graphUnit   9 graph
Unit 9 graph
 
Unit ix graph
Unit   ix    graph Unit   ix    graph
Unit ix graph
 
logic.pptx
logic.pptxlogic.pptx
logic.pptx
 
Analysis &amp; design of algorithm
Analysis &amp; design of algorithmAnalysis &amp; design of algorithm
Analysis &amp; design of algorithm
 
Lecture13
Lecture13Lecture13
Lecture13
 
Analysis and design of algorithms part 3
Analysis and design of algorithms part 3Analysis and design of algorithms part 3
Analysis and design of algorithms part 3
 
Lecture 16 - Dijkstra's Algorithm.pdf
Lecture 16 - Dijkstra's Algorithm.pdfLecture 16 - Dijkstra's Algorithm.pdf
Lecture 16 - Dijkstra's Algorithm.pdf
 
04 greedyalgorithmsii 2x2
04 greedyalgorithmsii 2x204 greedyalgorithmsii 2x2
04 greedyalgorithmsii 2x2
 
Unit II_Graph.pptxkgjrekjgiojtoiejhgnltegjte
Unit II_Graph.pptxkgjrekjgiojtoiejhgnltegjteUnit II_Graph.pptxkgjrekjgiojtoiejhgnltegjte
Unit II_Graph.pptxkgjrekjgiojtoiejhgnltegjte
 

More from Amrinder Arora

Convex Hull - Chan's Algorithm O(n log h) - Presentation by Yitian Huang and ...
Convex Hull - Chan's Algorithm O(n log h) - Presentation by Yitian Huang and ...Convex Hull - Chan's Algorithm O(n log h) - Presentation by Yitian Huang and ...
Convex Hull - Chan's Algorithm O(n log h) - Presentation by Yitian Huang and ...Amrinder Arora
 
Bron Kerbosch Algorithm - Presentation by Jun Zhai, Tianhang Qiang and Yizhen...
Bron Kerbosch Algorithm - Presentation by Jun Zhai, Tianhang Qiang and Yizhen...Bron Kerbosch Algorithm - Presentation by Jun Zhai, Tianhang Qiang and Yizhen...
Bron Kerbosch Algorithm - Presentation by Jun Zhai, Tianhang Qiang and Yizhen...Amrinder Arora
 
Arima Forecasting - Presentation by Sera Cresta, Nora Alosaimi and Puneet Mahana
Arima Forecasting - Presentation by Sera Cresta, Nora Alosaimi and Puneet MahanaArima Forecasting - Presentation by Sera Cresta, Nora Alosaimi and Puneet Mahana
Arima Forecasting - Presentation by Sera Cresta, Nora Alosaimi and Puneet MahanaAmrinder Arora
 
Stopping Rule for Secretory Problem - Presentation by Haoyang Tian, Wesam Als...
Stopping Rule for Secretory Problem - Presentation by Haoyang Tian, Wesam Als...Stopping Rule for Secretory Problem - Presentation by Haoyang Tian, Wesam Als...
Stopping Rule for Secretory Problem - Presentation by Haoyang Tian, Wesam Als...Amrinder Arora
 
Proof of O(log *n) time complexity of Union find (Presentation by Wei Li, Zeh...
Proof of O(log *n) time complexity of Union find (Presentation by Wei Li, Zeh...Proof of O(log *n) time complexity of Union find (Presentation by Wei Li, Zeh...
Proof of O(log *n) time complexity of Union find (Presentation by Wei Li, Zeh...Amrinder Arora
 
Proof of Cook Levin Theorem (Presentation by Xiechuan, Song and Shuo)
Proof of Cook Levin Theorem (Presentation by Xiechuan, Song and Shuo)Proof of Cook Levin Theorem (Presentation by Xiechuan, Song and Shuo)
Proof of Cook Levin Theorem (Presentation by Xiechuan, Song and Shuo)Amrinder Arora
 
Online algorithms in Machine Learning
Online algorithms in Machine LearningOnline algorithms in Machine Learning
Online algorithms in Machine LearningAmrinder Arora
 
Dynamic Programming - Part 1
Dynamic Programming - Part 1Dynamic Programming - Part 1
Dynamic Programming - Part 1Amrinder Arora
 
Divide and Conquer - Part 1
Divide and Conquer - Part 1Divide and Conquer - Part 1
Divide and Conquer - Part 1Amrinder Arora
 
Set Operations - Union Find and Bloom Filters
Set Operations - Union Find and Bloom FiltersSet Operations - Union Find and Bloom Filters
Set Operations - Union Find and Bloom FiltersAmrinder Arora
 
Binomial Heaps and Fibonacci Heaps
Binomial Heaps and Fibonacci HeapsBinomial Heaps and Fibonacci Heaps
Binomial Heaps and Fibonacci HeapsAmrinder Arora
 
R-Trees and Geospatial Data Structures
R-Trees and Geospatial Data StructuresR-Trees and Geospatial Data Structures
R-Trees and Geospatial Data StructuresAmrinder Arora
 
Tries - Tree Based Structures for Strings
Tries - Tree Based Structures for StringsTries - Tree Based Structures for Strings
Tries - Tree Based Structures for StringsAmrinder Arora
 
Splay Trees and Self Organizing Data Structures
Splay Trees and Self Organizing Data StructuresSplay Trees and Self Organizing Data Structures
Splay Trees and Self Organizing Data StructuresAmrinder Arora
 
BTrees - Great alternative to Red Black, AVL and other BSTs
BTrees - Great alternative to Red Black, AVL and other BSTsBTrees - Great alternative to Red Black, AVL and other BSTs
BTrees - Great alternative to Red Black, AVL and other BSTsAmrinder Arora
 
Binary Search Trees - AVL and Red Black
Binary Search Trees - AVL and Red BlackBinary Search Trees - AVL and Red Black
Binary Search Trees - AVL and Red BlackAmrinder Arora
 
Graphs, Trees, Paths and Their Representations
Graphs, Trees, Paths and Their RepresentationsGraphs, Trees, Paths and Their Representations
Graphs, Trees, Paths and Their RepresentationsAmrinder Arora
 

More from Amrinder Arora (20)

Convex Hull - Chan's Algorithm O(n log h) - Presentation by Yitian Huang and ...
Convex Hull - Chan's Algorithm O(n log h) - Presentation by Yitian Huang and ...Convex Hull - Chan's Algorithm O(n log h) - Presentation by Yitian Huang and ...
Convex Hull - Chan's Algorithm O(n log h) - Presentation by Yitian Huang and ...
 
Bron Kerbosch Algorithm - Presentation by Jun Zhai, Tianhang Qiang and Yizhen...
Bron Kerbosch Algorithm - Presentation by Jun Zhai, Tianhang Qiang and Yizhen...Bron Kerbosch Algorithm - Presentation by Jun Zhai, Tianhang Qiang and Yizhen...
Bron Kerbosch Algorithm - Presentation by Jun Zhai, Tianhang Qiang and Yizhen...
 
Arima Forecasting - Presentation by Sera Cresta, Nora Alosaimi and Puneet Mahana
Arima Forecasting - Presentation by Sera Cresta, Nora Alosaimi and Puneet MahanaArima Forecasting - Presentation by Sera Cresta, Nora Alosaimi and Puneet Mahana
Arima Forecasting - Presentation by Sera Cresta, Nora Alosaimi and Puneet Mahana
 
Stopping Rule for Secretory Problem - Presentation by Haoyang Tian, Wesam Als...
Stopping Rule for Secretory Problem - Presentation by Haoyang Tian, Wesam Als...Stopping Rule for Secretory Problem - Presentation by Haoyang Tian, Wesam Als...
Stopping Rule for Secretory Problem - Presentation by Haoyang Tian, Wesam Als...
 
Proof of O(log *n) time complexity of Union find (Presentation by Wei Li, Zeh...
Proof of O(log *n) time complexity of Union find (Presentation by Wei Li, Zeh...Proof of O(log *n) time complexity of Union find (Presentation by Wei Li, Zeh...
Proof of O(log *n) time complexity of Union find (Presentation by Wei Li, Zeh...
 
Proof of Cook Levin Theorem (Presentation by Xiechuan, Song and Shuo)
Proof of Cook Levin Theorem (Presentation by Xiechuan, Song and Shuo)Proof of Cook Levin Theorem (Presentation by Xiechuan, Song and Shuo)
Proof of Cook Levin Theorem (Presentation by Xiechuan, Song and Shuo)
 
Online algorithms in Machine Learning
Online algorithms in Machine LearningOnline algorithms in Machine Learning
Online algorithms in Machine Learning
 
NP completeness
NP completenessNP completeness
NP completeness
 
Algorithmic Puzzles
Algorithmic PuzzlesAlgorithmic Puzzles
Algorithmic Puzzles
 
Dynamic Programming - Part 1
Dynamic Programming - Part 1Dynamic Programming - Part 1
Dynamic Programming - Part 1
 
Greedy Algorithms
Greedy AlgorithmsGreedy Algorithms
Greedy Algorithms
 
Divide and Conquer - Part 1
Divide and Conquer - Part 1Divide and Conquer - Part 1
Divide and Conquer - Part 1
 
Set Operations - Union Find and Bloom Filters
Set Operations - Union Find and Bloom FiltersSet Operations - Union Find and Bloom Filters
Set Operations - Union Find and Bloom Filters
 
Binomial Heaps and Fibonacci Heaps
Binomial Heaps and Fibonacci HeapsBinomial Heaps and Fibonacci Heaps
Binomial Heaps and Fibonacci Heaps
 
R-Trees and Geospatial Data Structures
R-Trees and Geospatial Data StructuresR-Trees and Geospatial Data Structures
R-Trees and Geospatial Data Structures
 
Tries - Tree Based Structures for Strings
Tries - Tree Based Structures for StringsTries - Tree Based Structures for Strings
Tries - Tree Based Structures for Strings
 
Splay Trees and Self Organizing Data Structures
Splay Trees and Self Organizing Data StructuresSplay Trees and Self Organizing Data Structures
Splay Trees and Self Organizing Data Structures
 
BTrees - Great alternative to Red Black, AVL and other BSTs
BTrees - Great alternative to Red Black, AVL and other BSTsBTrees - Great alternative to Red Black, AVL and other BSTs
BTrees - Great alternative to Red Black, AVL and other BSTs
 
Binary Search Trees - AVL and Red Black
Binary Search Trees - AVL and Red BlackBinary Search Trees - AVL and Red Black
Binary Search Trees - AVL and Red Black
 
Graphs, Trees, Paths and Their Representations
Graphs, Trees, Paths and Their RepresentationsGraphs, Trees, Paths and Their Representations
Graphs, Trees, Paths and Their Representations
 

Recently uploaded

Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxShobhayan Kirtania
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajanpragatimahajan3
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 

Recently uploaded (20)

Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptx
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 

Graph Traversal Algorithms - Depth First Search Traversal

  • 2.  Instructor Prof. Amrinder Arora amrinder@gwu.edu Please copy TA on emails Please feel free to call as well   Available for study sessions Science and Engineering Hall GWU Algorithms Graph Traversal Techniques 2 LOGISTICS
  • 3. Algorithms Analysis Asymptotic NP- Completeness Design D&C Greedy DP Graph B&B Applications Algorithms Graph Traversal Techniques 3 WHERE WE ARE  Done  Done  Starting..  Done  Done
  • 4. Suppose you have two jugs, one capable of holding 5 cups, and one capable of holding 8 cups. [The jugs are irregularly shaped and without markings, so you can't determine how much water is in either jug unless it is completely full or completely empty.] You also have a faucet, and as much water as you'd like. Can you get 3 cups? Can you obtain 1 cup? 2 cups? 4 cups? 6 cups? 7 cups? Algorithms Graph Traversal Techniques 4 PUZZLES
  • 5. Where can we go from here: (x,y)  a. (0,y) / (x,0)  Empty first/second b. (5,y) / (x,8)  Fill first/second c. (5,x+y-5)  Second to First, x+y > 5 d. (x+y,0)  Second to First e. (x+y-8,8)  First to Second, x+y > 8 f. (0,x+y)  First to Second Algorithms Graph Traversal Techniques 5 PUZZLES (CONT.)
  • 6. (0,0) 1. (0,8) // b 2. (5,3) // c 3. (0,3) // a 4. (3,0) // d 5. (3,8) // a 6. (5,6) // c 7. (0,6) // a 8. (5,1) // c 9. (0,1) // a Algorithms Graph Traversal Techniques 6 PUZZLES (CONT.)
  • 7. While ()  Make a transition step  Reach a new state  If new state is what you were looking for  “Eureka Eureka” This also works if trying to change state in life  [Or in the US.] Algorithms Graph Traversal Techniques 7 POSSIBLE SOLUTION
  • 8. A graph search (or traversal) technique visits every node exactly once in a systematic fashion.  Basic use case is the search Two basic techniques:  Depth-First Search (DFS)  Breadth-First Search (BFS) Algorithms Graph Traversal Techniques 8 GRAPH TRAVERSAL TECHNIQUES
  • 9. Algorithms Graph Traversal Techniques 9 AMAZING WHAT PROBLEMS WE CAN SOLVE USING TRAVERSAL TECHNIQUES
  • 10. Edges of input graph G = (V,E) can be classified in context of the forest G’ produced by the traversal of G Tree edges (aka Discovery Edge): Edge (u,v) if v first discovered by exploring edge (u,v) Back edges: Edge (u,v) connecting a vertex u to an ancestor v. Self loops are also back edges. Forward edge: Edge (u,v) connecting a vertex u to a descendent v. Cross edges: All other edges Algorithms Graph Traversal Techniques 10 CLASSIFICATION OF EDGES
  • 11. 1) DFS follows the following rules: Select an unvisited node s, visit it, and treat as the current node 2) Find an unvisited neighbor of the current node, visit it, and make it the new current node; 3) If the current node has no unvisited neighbors, backtrack to the its parent, and make that the new current node Repeat the steps 2 and 3 until no more nodes can be visited. 4) If there are still unvisited nodes, repeat from step 1. [Use of backtracking suggests that a stack is a good data structure for DFS implementation] Algorithms Graph Traversal Techniques 11 DEPTH FIRST SEARCH (DFS)
  • 12. Procedure DFS(input: graph G) Stack T; Integer s,x; while (G has an unvisited node) do s := an unvisited node visit(v) T.push(v) while (T is not empty) do x := T.top() if (x has an unvisited neighbor y) then visit(y) T.push(y) else T.pop() endif endwhile endwhile Algorithms Graph Traversal Techniques 12 DFS IMPLEMENTATION
  • 13. dfs (Graph G) { // all vertices of G are first painted white while there is a white node in G { dfs-visit(G, u) } } dfs-visit (Graph G, Vertex u) { the vertex u is painted gray u.d = time++ // u has now been discovered for all white successors v of u { dfs-visit(G, v) } u is painted black u.f = time++ // Exploration of u has finished } Algorithms Graph Traversal Techniques 13 DFS – ALTERNATE ALGORITHMIC VIEW
  • 14. https://www.cs.usfca.edu/~galles/visualization/DFS.html  For undirected graphs:  http://www.algolist.net/Algorithms/Graph/Undirected/Depth- first_search  For directed graphs:  http://www.cs.duke.edu/csed/jawaa2/examples/DFS.html Algorithms Graph Traversal Techniques 14 DFS ANIMATION
  • 15.  Every node is visited once. Also, every edge (x,y) is "crossed" twice: one time when node y is checked from x to see if it is visited (if not visited, then y would be visited from x), and another time, when we back track from y to x.  Therefore, the time of DFS is O(n+|E|), or O(n+m)  If the graph is connected, the time is O(m) because the graph has at least n-1 edges, and so n+m <= 2m +1, implying that n+m is O(m). Algorithms Graph Traversal Techniques 15 DFS TIME COMPLEXITY
  • 16.  If the start of node u is marked as “(u”, and the end as “u)”, then the overall parenthetical expression is well-formed. For example: (u (v (z z) (w w) v) u)  Proof: Immediate from the recursive nature of the algorithm  dfs-visit(u)  u.d  This gets logged as “(u”  Recursive calls to dfs-visit of other nodes  u.f  This gets logged as “u)”  In other words: [d,f] intervals are properly nested Algorithms Graph Traversal Techniques 16 PARENTHESIS THEOREM
  • 17.  Theorem: In DFS, every edge of undirected graph G is either a tree edge or a back edge. (In other words, no forward or cross edges exist in G’ produced by DFS traversal of G). (Theorem – book section 7.2.3.)  Discussion Points:  Can a “forward” edge exist in DFS traversal?  Can a “cross” edge exist in DFS traversal?  Let (x,y) be a cross edge, that is, x and y are in separate subtrees of the DFS tree. Assume x was visited before y.  When a search for unvisited neighbors of x was conducted and none found, x was backtracked from, never to return to x again.  Why did we skip y at that time?  Since y is a neighbor of x and y is not visited at time t, y would have to be visited from x before the algorithm backtracks from x. That would make y a descendent of x. Contradiction.  Therefore, no such cross edge (x,y) can exist in a DFS tree. Algorithms Graph Traversal Techniques 17 DFS EDGE CLASSIFICATION THEOREM
  • 18.  Use a counter to count the number of time the outer while- loop iterates in the DFS algorithm, the counter value at the end will be equal to the number of connected components of the input graph G.  This is because the body of the outer loop, that is, every iteration, fully traverses the connected component that contains the node v.  If the counter value is 1, then the graph is connected. That is, the DFS algorithm becomes a connectedness-testing algorithm that tells if a graph is connected, in O(n+|E|) time  If the counter value is > 1, the algorithm will indicate that the graph is disconnected, and the nodes visited in each iteration constitute a separate connected component. In other terms, the DFS algorithm identifies the various connected components. Algorithms Graph Traversal Techniques 18 FIRST APPLICATION OF DFS: CONNECTIVITY
  • 19.  Given: A uniformly weighted graph (all edges have weight w = 1)  In that case, all spanning trees are of the same weight (because all trees of n nodes have exactly n-1 edges)  Thus, to find a minimum spanning tree in such graphs, it suffices to find any spanning tree.  DFS yields a spanning tree (if the input graph is connected, otherwise, it is a spanning forest). That tree is then a minimum spanning tree. The time to compute the tree is O(|E|), which is better than the O(|E| log |E|) time MST algorithm for general weighted graphs. Algorithms Graph Traversal Techniques 19 SECOND APPLICATION OF DFS: MINIMUM SPANNING TREES IN UNIFORMLY WEIGHTED GRAPHS
  • 20.  Definition: A node in a connected graph is called an “articulation point” if the deletion of that node disconnects the graph.  Definition: A connected graph is called biconnected if it has no articulation points. That is, the deletion of any single node leaves the graph connected.  In the case of networks, an articulation point is referred to as a single point of failure.  The Biconnectivity Problem:  Input: a connected graph G  Problem: Determine whether or not the graph is biconnected. If not biconnected, find all the articulation points. Algorithms Graph Traversal Techniques 20 THIRD APPLICATION OF DFS: BICONNECTIVITY
  • 21.  Not biconnected – node G is an articulation point (single point of failure)  If there was one more edge, say between E and L, then G would not be an articulation point. Algorithms Graph Traversal Techniques 21 EXAMPLE
  • 22.  Observation: A non-root node x is an articulation point if and only if x has a subtree from which no backward edge originates and ends at a proper ancestor of x.  Each node i will have two new labels: DFN[i] and L[i].  DFN[i] ::= sequence in which i is visited. Thus, the first node visited (i.e., the root) has its DFN = 1. The second node visited has a DFN = 2, and so on.  L[i] ::= Lowest DFN number of node which can be reached from node i using zero or more tree edges, and then a single back edge; or DFN[i], whichever is lower Algorithms Graph Traversal Techniques 22 BICONNECTIVITY (CONT.)
  • 23.  Computing DFN[i] and L[i]  The DFNs are easy to compute using a simple counter.  We note that L[x]=min{ DFN[x], {DFN[y] | (x,y) is a back edge}, {L[w] | for each child w of x} } Algorithms Graph Traversal Techniques 23 BICONNECTIVITY (CONT.)
  • 24. Algorithms Graph Traversal Techniques 24 Procedure DFS(input: graph G,) Stack T; Integer num = 1; Integer DFN[1:n], L[1:n], Parent[1:n] Node s := an unvisited node visit(s), T.push(s), DFN[s] := num++, L[s] := DFN[s] While (T is not empty) do Node x := top(T) if (x has an unvisited neighbor y) then visit(y), T.push(y), DFN[y] := num++, Parent[y] := x, L[y] := DFN[y] Else pop(T) for (every neighbor y of x) do if (y != parent[x] and DFN[y] < DFN[x]) then /* y is an ancestor of x, and (x,y) is a back edge*/ L[x] := min(L[x],DFN[y]) Else if (x = Parent[y]) then L[x] : min(L[x],L[y]) if (L[y] >= DFN[x] and x is not root) then x is an articulation point if (s has more than one child) then s is an articulation point DFSBICONNECTIVITY
  • 25.  Wikipedia link on DFS Algorithms Graph Traversal Techniques 25 READING / EXTERNAL LINKS
  • 26. Algorithms Analysis Asymptotic NP- Completeness Design D&C Greedy DP Graph B&B Applications Algorithms Graph Traversal Techniques 26 WHERE WE ARE  Done  Done  Started today..  Done  Done