A shortest-path tree rooted at a source vertex is a spanning tree whose unique tree route from the source to every vertex solves the shortest path problem in the original weighted graph. Dijkstra's algorithm constructs one for a finite connected graph with nonnegative edge lengths, recording a predecessor whenever a distance improves. It need not be a minimum spanning tree: one minimizes each source-route length, the other the total weight of the tree's edges.
In a finite connected graph with strictly positive edge weights, choose any shortest path from a root to every other vertex , and let be its penultimate vertex. Every prefix is shortest: a better prefix followed by the final edge would give a cheaper walk, whose positive-weight cycles can be erased to give a cheaper path. Thus the displayed distance identity holds.
Following predecessors strictly decreases the shortest-path distance, so no predecessor cycle is possible. Since every nonroot vertex has a predecessor, every chain reaches the root. Opposite predecessor choices cannot select the same undirected edge, again by strict distance decrease. The selected graph is connected and has exactly one edge per nonroot vertex, so is a spanning tree. Along its root paths the distance differences telescope, proving that it is a shortest-path tree even if the original shortest paths were chosen independently.
In a triangle with root , assign and . Among graph paths, the unique shortest path from to is , and that from to is , both of weight one. A shortest-path tree would have to contain all three edges, impossible for a tree. The example uses shortest simple paths; arbitrary walks can have unboundedly negative weight by repeatedly traversing the negative edge.
Articles by others on the same topic
A **shortest-path tree** is a type of data structure used in graph theory that represents the shortest paths from a single source vertex to all other vertices in a weighted graph. The shortest-path tree is a subtree of the graph and satisfies the property that for any vertex in the tree, the path from the source vertex to that vertex is the shortest possible path in the graph. ### Key Characteristics: 1. **Source Vertex**: The node from which the shortest paths originate.
