



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
An overview of graph traversal algorithms, including depth-first search (dfs) and breadth-first search (bfs. It also covers the concept of shortest paths in weighted directed graphs and introduces dijkstra's algorithm as a solution to find the shortest path between two vertices.
Typology: Slides
1 / 5
This page cannot be seen from the preview
Don't miss anything!




Discrete Mathematics
v v 3
v 2
(^1) v 3
v 1 2 v^2
v 4
v 3
v 5
2
v 1
3 v 4
4
v 5
5
x x^ x x (^) x
visit stack v 3 v (^3) v 2 v 3 , v (^2) v 1 v 3 , v 2 , v (^1) backtrack v 3 , v (^2)
v 1 v 3
v 2 x x^ x 3 ,^2 v 4 v 3 , v 2 , v (^4) v 5 v 3 , v 2 , v 4 , v (^5) backtrack v 3 , v 2 , v (^4) backtrack v 3 , v (^2) backtrack v (^3) backtrack empty
v 4 v^5
x (^) x
v (^5)
1
v 1 2 3
v 2 v 3
Visit Queue (front to back) v 5 v 5 empty x (^) v (^3) v v 3 v 3 4
3
v (^2)
4
v (^1)
5
1
v (^4) v 5 G
x
v 3 v 3 v 4 v 3 , v 4 v 4 v 2 v 4 , v 2 v 2 empty v 1 v 1 empty
x
x x
Department of Computer & Information Sciences Pakistan Institute of Engineering and Applied Sciences
Umar Faiz http://www.pieas.edu.pk/umarfaiz/cis
Discrete Mathematics