Algorithms Homework 5: Graph Algorithms (Part II)

23 阅读1分钟

Download link:# Algorithms Homework 5: Graph Algorithms (Part II)

Description

5/5 – (2 votes)

In this homework, we will find shortest-paths in graphs with a single source node.

Problem 1: Bellman-Ford Algorithm 50 points

Demonstrate Bellman-Ford algorithm on the following graph. In each stage of the algorithm, clearly state the shortest distance estimate at each node from the source.

        • v8
          32
          v51v7
          3
          v6
          4213
          3v34
          v2v4
          21
          v1

Demonstrate Dijkstra’s algorithm on the following graph. In each stage of the algorithm, clearly state the shortest distance estimate at each node from the source.

Bonus Problem (10 points):

  1. Implement Dijkstra’s algorithm on graphs represented as adjacency lists in Python, and val-idate your code on the example graph given in Problem 2.