l5q2
You cannot submit for this problem because the homework's deadline is due.
Description
Use python3 or OCaml to implement Bellman Ford algorithm.
Submission Format
Submit a tar or zip file including a script named BellmanFord.ml
and all the related class you have implemented. There are no restriction on the filenames of your imported classes.
IO
Input
The first line contains the number of edges edge_num
.
Starting from the second line, information of directed edges will be provided in the form of nodeA nodeB weight
.
The final two lines will give you the start and terminate node.
Output
Output the shortest path in the form if a list, starting from the starting node to the terminating node. Note that the node name is expected to be a string.
Sample IO
Sample 1
input
This is the exactly the same case as the one on the lecture slide.
10
s c 2
s b 4
c b 1
c d -3
c e 10
e t 3
d t -1
b d 5
d e 2
e t 3
s
t
output
['s', 'c', 'd', 't']