You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/graph/01_bfs.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -42,7 +42,7 @@ while (!q.empty()) {
42
42
We can notice that the difference between the distances between the source`s` and two other vertices in the queue differs by at most one.
43
43
Especially, we know that $d[v] \le d[u] \le d[v] + 1$ for each $u \in Q$.
44
44
The reason for this is, that we only add vertices with equal distance or with distance plus one to the queue during each iteration.
45
-
Assuming there exists a $u$ in the queue with $d[u] - d[v] > 1$, then $u$ must have beeninsert in the queue via a different vertex $t$ with $d[t] \ge d[u] - 1 > d[v]$.
45
+
Assuming there exists a $u$ in the queue with $d[u] - d[v] > 1$, then $u$ must have beeninserted into the queue via a different vertex $t$ with $d[t] \ge d[u] - 1 > d[v]$.
46
46
However this is impossible, since Dijkstra's algorithm iterates over the vertices in increasing order.
47
47
48
48
This means, that the order of the queue looks like this: