G=Graph({1:{2:2,3:6,4:8},2:{3:3,4:7},3:{4:5},4:{5:20}}, sparse=True)
G.plot(edge_labels=True)
G.shortest_paths(1, by_weight=True)