Acerca del Algoritmo de Dijkstra

Alvaro Salas
DOI: https://doi.org/10.48550/arXiv.0810.0075
2008-10-01
Abstract:In this paper we prove the correctness of Dijkstra's algorithm. We also discuss it and at the end we show an application.
Data Structures and Algorithms
What problem does this paper attempt to address?
The problem that this paper attempts to solve is **to prove the correctness of Dijkstra's algorithm and discuss its applications**. Specifically, the paper focuses on the problem of calculating the shortest paths from a given vertex to all other vertices in a graph with non - negative labels (weights) (single - source shortest paths). This problem is very common in practical applications. For example, in a geographical distribution map, an edge represents the connection cost (such as price, distance, etc.) between two locations, and the shortest path from one point to another needs to be found. ### Main content of the paper 1. **Introduction part**: - Introduced the background and application scenarios of Dijkstra's algorithm, especially the path planning problem in geographical distribution maps. - Mentioned that Dijkstra's algorithm was proposed by E.W. Dijkstra in 1959 to solve the single - source shortest - path problem. 2. **Preliminary definitions**: - Defined concepts such as directed graph (digraph), weighted directed graph (weighted digraph), path and its weight, etc. - Formulated the description of the path weight: \[ p(u\rightarrow v)=p(x_0,x_1)+p(x_1,x_2)+\cdots +p(x_{m - 1},x_m) \] - Defined the concept of the minimum - cost path: there is no path with a smaller weight than the current path. 3. **Description and correctness proof of Dijkstra's algorithm**: - **Input**: A directed graph with positive weights and two different vertices \(a\) and \(z\), where there is a path from \(a\) to \(z\). - **Output**: The weight of the minimum - cost path from \(a\) to \(z\). - **Steps**: 1. Initialize the sets \(S_0=\emptyset\) and \(T_0 = V\), and set the label \(L(v)\) of each vertex \(v\) to \(0\) (if \(v = a\)) or \(\infty\) (if \(v\neq a\)). 2. For each step \(i\), select the vertex \(u\) with the smallest label in \(T_{i - 1}\) to add to \(S_i\), and update the labels of its adjacent vertices. 3. Stop when all vertices are added to \(S\) or the target vertex \(z\) is found. - **Correctness proof**: - Proved by mathematical induction that for each \(u\in S\) (and \(u\neq a\)), the weight of any path from \(a\) to \(u\) is at least \(L(u)\), and there is a path from \(a\) to \(u\) whose weight is equal to \(L(u)\). 4. **Discussion and applications**: - Discussed the application scenarios of the algorithm, including how to handle the situation where there is no path. - Provided a specific example to show how to use Dijkstra's algorithm to find the minimum - cost path from \(a\) to \(z\) in an undirected weighted graph. Through these contents, the paper not only proves the correctness of Dijkstra's algorithm, but also explains in detail its working principle and application scenarios, ensuring that readers can understand and apply this classic algorithm.