A spanning tree of the connected graph is a subgraph containing every vertex, connected and without cycles in a graph. Equivalently, between every pair of vertices it has exactly one graph path. For a finite graph with vertices, it has edges.
A shortest-path tree rooted at is a spanning tree such that, for every vertex , the unique graph path in has minimum total edge length among all graph paths in . The objective is the sum of the lengths along each route, not the sum of all the tree's edge lengths.
For Dijkstra's algorithm, initialize and for other vertices, with no predecessor initially. Repeatedly select an unfinalized vertex of least tentative distance, finalize it, and relax each edge : if , replace by that value and set the predecessor of to . Continue until all vertices are finalized. The predecessor edges form the shortest-path tree.
To justify finalization, consider a supposedly shorter route to the next selected vertex. Its first unfinalized vertex is preceded by a finalized one, whose relaxation would already have offered a tentative distance no greater than the length of that route's prefix. Nonnegative remaining lengths would contradict the selected vertex's minimal tentative label. Thus final labels are the true shortest distances. Strictly positive lengths also make predecessors have smaller distances, ruling out predecessor cycles in a graph.
Starting from , the initial tentative distances to are . Finalize next. Its edges improve these to , , and . No subsequent relaxation improves them. Hence one shortest-path tree is
These values follow either by completing Dijkstra's algorithm in the order , or by observing that any internal vertex on a simple route adds to the direct-edge cost: only the internal vertex can reduce it.

Articles by others on the same topic (0)

There are currently no matching articles.