Book
Advanced Engineering Mathematics
Author
Erwin Kreyszig
Edition
8th Edition
g=Graph() g = Graph({1:{2:'2',4:'5'}, 2:{1:'2',3:'3',4:'1'},3:{2:'3',4:'1',5:'2'},4:{1:'5',2:'1',3:'1',5:'4'},5:{3:'2',4:'4'}}); g.plot(edge_labels=True) // plots the graph with edges with their weights g.shortest_path(1,5) [1, 4, 5] //output g.shortest_path(3,1) [3, 2, 1] //output g.shortest_path(2,5) [2,4,5] //output
Solution by:
- Koumudi, Student, SNIST