You are viewing a single comment's thread. Return to all comments →
I did something similar in Python 3, but storing weights in a sparse adjacency matrix:
n, m = map(int, input().split()) W = defaultdict(dict) for _ in range(m): u, v, w = map(int, input().split()) W[u][v] = W[v][u] = min(w, W[u].get(v, wmax)) s = int(input())
Seems like cookies are disabled on this browser, please enable them to open this website
Dijkstra: Shortest Reach 2
You are viewing a single comment's thread. Return to all comments →
I did something similar in Python 3, but storing weights in a sparse adjacency matrix: