Ch8_Traversing_Optimization
Ch8_Traversing_Optimization
• SED
• SRDG
• SGD
• SGD
• SDG
• SDG
• SDG
Depth-first search (DFS): Examples
and Applications
• Example: Animated example of a depth-first search.
• ad
Kruskal’s algorithm: Exercise
• Exercise 7: Apply Kruskal’s algorithm on the following graph:
Minimum-Spanning-Tree algorithms:
Prim's algorithm
• Prim's algorithm: The algorithm operates by building a tree one vertex at a
time, from an arbitrary starting vertex, at each step adding the cheapest
possible connection from the tree to another vertex.
• Example: The execution of Prim’s algorithm on the following graph: Prim's
algorithm starting at vertex A. In the third step, edges BD and AB both have
weight 2, so BD is chosen arbitrarily. After that step, AB is no longer a
candidate for addition to the tree because it links two nodes that are already
in the tree.
• Asef
• SFE
• SEF
Prim's algorithm: Exercise
• Exercise 8: Apply Prim's algorithm on the following graph: