Essay: A Note on Two Problems in Connexion with Graphs
Overview
Edsger Dijkstra’s 1959 note introduces two fundamental graph problems and presents simple, efficient greedy algorithms to solve them. The first is the single-source shortest path problem in a graph with non-negative edge lengths. The second is constructing a spanning tree that connects all vertices with minimum total length. Both algorithms proceed by growing a set of vertices or edges in stages, each stage making a locally optimal choice that can be proved globally optimal.
Single-source shortest paths
Given a graph with non-negative edge lengths and a designated source vertex, the task is to determine the shortest distance from the source to every other vertex and, if desired, the corresponding paths. Dijkstra assigns a tentative label to each vertex: zero for the source, infinity for all others. Repeatedly, he selects the not-yet-finalized vertex with the smallest tentative label, declares that label final, and relaxes outgoing edges from it by lowering neighbors’ tentative labels when a shorter route is discovered through the selected vertex. Recording the predecessor that yields each improvement recovers shortest paths.
Correctness insight
The key invariant is that once a vertex is selected as having the smallest tentative label among all unsettled vertices, its label equals the true shortest distance. This follows from non-negativity: any alternative route to that vertex would have to pass through an unsettled vertex whose tentative label cannot be smaller, so no shorter path exists. Inductively, each selection is safe, and the process yields correct distances for all vertices. The algorithm terminates after each vertex has received a final label, at which point the predecessors form a shortest-path tree rooted at the source.
Minimum spanning tree
The second problem asks for a subset of edges connecting all vertices with minimum total length, assuming an undirected, connected graph. Dijkstra describes a method that starts from any vertex and grows a tree one edge at a time. At each step it chooses, among all edges with exactly one endpoint in the current tree, the edge of minimum length, adding its outside endpoint and that edge to the tree. Repeating this until all vertices are included yields a spanning tree of minimum weight.
Correctness insight
The safety of each greedy choice rests on an exchange argument: if a minimum spanning tree did not contain the chosen minimum-length crossing edge, adding it would form a cycle that must contain some other edge crossing the same cut; replacing that longer edge with the chosen edge produces a spanning tree no heavier than the original. Hence there exists an optimal tree containing every chosen edge, and the final tree is optimal.
Complexity and implementation
Both methods are conceptually simple and efficient for the hardware and software of the time. Using arrays for tentative labels and a linear search to select the smallest label, the shortest path algorithm requires roughly quadratic time in the number of vertices, as does the spanning tree algorithm when selecting the lightest edge crossing the cut by scanning. The shortest path method crucially relies on non-negative lengths; negative edges would invalidate the selection rule. Both algorithms can construct the associated trees by recording predecessors or chosen edges as they proceed.
Impact
The note crystallized two archetypal greedy strategies, each justified by a clean invariant or exchange argument, and provided practical procedures for routing and network design. The shortest path algorithm and the minimum spanning tree algorithm have become standard tools across computer science, operations research, and communications, valued for their clarity, efficiency, and ease of implementation.
Edsger Dijkstra’s 1959 note introduces two fundamental graph problems and presents simple, efficient greedy algorithms to solve them. The first is the single-source shortest path problem in a graph with non-negative edge lengths. The second is constructing a spanning tree that connects all vertices with minimum total length. Both algorithms proceed by growing a set of vertices or edges in stages, each stage making a locally optimal choice that can be proved globally optimal.
Single-source shortest paths
Given a graph with non-negative edge lengths and a designated source vertex, the task is to determine the shortest distance from the source to every other vertex and, if desired, the corresponding paths. Dijkstra assigns a tentative label to each vertex: zero for the source, infinity for all others. Repeatedly, he selects the not-yet-finalized vertex with the smallest tentative label, declares that label final, and relaxes outgoing edges from it by lowering neighbors’ tentative labels when a shorter route is discovered through the selected vertex. Recording the predecessor that yields each improvement recovers shortest paths.
Correctness insight
The key invariant is that once a vertex is selected as having the smallest tentative label among all unsettled vertices, its label equals the true shortest distance. This follows from non-negativity: any alternative route to that vertex would have to pass through an unsettled vertex whose tentative label cannot be smaller, so no shorter path exists. Inductively, each selection is safe, and the process yields correct distances for all vertices. The algorithm terminates after each vertex has received a final label, at which point the predecessors form a shortest-path tree rooted at the source.
Minimum spanning tree
The second problem asks for a subset of edges connecting all vertices with minimum total length, assuming an undirected, connected graph. Dijkstra describes a method that starts from any vertex and grows a tree one edge at a time. At each step it chooses, among all edges with exactly one endpoint in the current tree, the edge of minimum length, adding its outside endpoint and that edge to the tree. Repeating this until all vertices are included yields a spanning tree of minimum weight.
Correctness insight
The safety of each greedy choice rests on an exchange argument: if a minimum spanning tree did not contain the chosen minimum-length crossing edge, adding it would form a cycle that must contain some other edge crossing the same cut; replacing that longer edge with the chosen edge produces a spanning tree no heavier than the original. Hence there exists an optimal tree containing every chosen edge, and the final tree is optimal.
Complexity and implementation
Both methods are conceptually simple and efficient for the hardware and software of the time. Using arrays for tentative labels and a linear search to select the smallest label, the shortest path algorithm requires roughly quadratic time in the number of vertices, as does the spanning tree algorithm when selecting the lightest edge crossing the cut by scanning. The shortest path method crucially relies on non-negative lengths; negative edges would invalidate the selection rule. Both algorithms can construct the associated trees by recording predecessors or chosen edges as they proceed.
Impact
The note crystallized two archetypal greedy strategies, each justified by a clean invariant or exchange argument, and provided practical procedures for routing and network design. The shortest path algorithm and the minimum spanning tree algorithm have become standard tools across computer science, operations research, and communications, valued for their clarity, efficiency, and ease of implementation.
A Note on Two Problems in Connexion with Graphs
Introduces the algorithm now known as Dijkstra's algorithm for finding the shortest path between nodes in a graph and discusses related graph problems. One of the foundational papers in algorithms and graph theory.
- Publication Year: 1959
- Type: Essay
- Genre: Computer Science, Algorithms, Graph theory
- Language: en
- View all works by Edsger Dijkstra on Amazon
Author: Edsger Dijkstra
Edsger Dijkstra, a pioneer in computer science known for his algorithms, programming languages, and academic contributions.
More about Edsger Dijkstra
- Occup.: Scientist
- From: Netherland
- Other works:
- Solution of a Problem in Concurrent Programming Control (1965 Essay)
- Go To Statement Considered Harmful (1968 Essay)
- The Structure of the 'THE' Multiprogramming System (1968 Essay)
- Notes on Structured Programming (1970 Essay)
- The Humble Programmer (1972 Essay)
- Self-stabilizing Systems in Spite of Distributed Control (1974 Essay)
- Guarded Commands, Nondeterminacy and Formal Derivation of Programs (1975 Essay)
- A Discipline of Programming (1976 Book)
- Selected Writings on Computing: A Personal Perspective (1982 Collection)
- On the Cruelty of Really Teaching Computing Science (1989 Essay)