Download link:# Algorithms (Sec: 102) Homework 4: Graph Algorithms: Part I
Description
5/5 – (2 votes)
In this homework, we will focus our attention to searching on graphs and finding minimum span-ning trees.
Problem 1: Graph Traversal 50 points
- Demonstrate both breadth-first search (BFS) and depth-first search (DFS) algorithms (with v1 as the start node) on the unweighted, undirected graph shown in Figure 1. Clearly show how each node-attribute (including frontier) changes in each iteration in both the algorithms. (20 points)
- Implement both BFS and DFS algorithms in Python using a graph class based on adjacency list representation, and demonstrate it on the example graph shown in Figure 1. (30 points)
Figure 1: Example Graph for Search Algorithms
Topic 4: Graph Algorithms: Part I 2
Problem 2: Minimum Spanning Trees 50 points
- Demonstrate Prim’s algorithm (with vertex v10 as the start node) for the Petersen graph shown in Figure 2. (20 points)
- Implement Prim’s algorithm in Python as a method within the graph class built using adja-cency matrix representation, and demonstrate it on the Petersen graph shown in Figure 2. (15 points)