What file do you want to read? graph2.txt Vertices: [a, b, s, c, d, e, f] Edges: a -> d: 1 a -> b: 6 b -> e: 1 s -> f: 6 s -> a: 3 s -> c: 2 c -> a: 2 c -> d: 4 d -> e: 4 f -> e: 2 Removing vertex s from the priority queue and visiting it. Considering edge (u, v) = s -> a Old distance (dist[v]) = 999999 New distance (alt = dist[u] + weight(u, v)) = 0 + 3 = 3 Updating dist[a] from 999999 to 3 (adding/updating a in the pri queue also). Updating prev[a] from undefined to s. Considering edge (u, v) = s -> c Old distance (dist[v]) = 999999 New distance (alt = dist[u] + weight(u, v)) = 0 + 2 = 2 Updating dist[c] from 999999 to 2 (adding/updating c in the pri queue also). Updating prev[c] from undefined to s. Considering edge (u, v) = s -> f Old distance (dist[v]) = 999999 New distance (alt = dist[u] + weight(u, v)) = 0 + 6 = 6 Updating dist[f] from 999999 to 6 (adding/updating f in the pri queue also). Updating prev[f] from undefined to s. Removing vertex c from the priority queue and visiting it. Considering edge (u, v) = c -> a Old distance (dist[v]) = 3 New distance (alt = dist[u] + weight(u, v)) = 2 + 2 = 4 No update needed; alt is not less than old distance. Considering edge (u, v) = c -> d Old distance (dist[v]) = 999999 New distance (alt = dist[u] + weight(u, v)) = 2 + 4 = 6 Updating dist[d] from 999999 to 6 (adding/updating d in the pri queue also). Updating prev[d] from undefined to c. Removing vertex a from the priority queue and visiting it. Considering edge (u, v) = a -> b Old distance (dist[v]) = 999999 New distance (alt = dist[u] + weight(u, v)) = 3 + 6 = 9 Updating dist[b] from 999999 to 9 (adding/updating b in the pri queue also). Updating prev[b] from undefined to a. Considering edge (u, v) = a -> d Old distance (dist[v]) = 6 New distance (alt = dist[u] + weight(u, v)) = 3 + 1 = 4 Updating dist[d] from 6 to 4 (adding/updating d in the pri queue also). Updating prev[d] from c to a. Removing vertex d from the priority queue and visiting it. Considering edge (u, v) = d -> e Old distance (dist[v]) = 999999 New distance (alt = dist[u] + weight(u, v)) = 4 + 4 = 8 Updating dist[e] from 999999 to 8 (adding/updating e in the pri queue also). Updating prev[e] from undefined to d. Removing vertex f from the priority queue and visiting it. Considering edge (u, v) = f -> e Old distance (dist[v]) = 8 New distance (alt = dist[u] + weight(u, v)) = 6 + 2 = 8 No update needed; alt is not less than old distance. Removing vertex e from the priority queue and visiting it. Shortest path is: s a d e Distance is: 8 Final dist map: a: 3 b: 9 s: 0 c: 2 d: 4 e: 8 f: 6 Final prev map: a: s b: a s: undefined c: s d: a e: d f: s