Professional Documents
Culture Documents
E: (t, x), (t, y), (t, z), (x, t), (y, x), (y, z), (z, x), (z, s), (s, t), (s, y)
(V)
O(V)
O(VE)
O(E)
O(E)
v1 2 v2 v .d = δ (s, v )
6
5 7 2
11 2
v4
5 3
14
4 v3
s 0 v1.d = δ (s, v1) 11 v4.d = δ (s, v4)
v3.d = δ (s, v3)
MA512: Data Structures and Algorithms
9
Shortest path properties (6)
• Precedessor-subgraph property
Once 𝑣. 𝑑 = 𝛿 𝑠, 𝑣 for all 𝑣 ∈ 𝑉, the predecessor
subgraph is a shortest-paths tree rooted at s
6 7