Add Dijkstra algorithm illustrations and explanations

This commit is contained in:
trekhleb 2025-11-07 21:43:21 +01:00
parent a88971df9e
commit e2ed5cc3f5

View File

@ -83,6 +83,10 @@ If the node that we're visiting (in this case the node `C`) is already in the qu
Now we now the shortest distances to ech node from the start node `A`. In practice, during the distance calculations we also record the the `previousVertices` for each node to be able to show the exact sequence of nodes that forms the shortest path. Now we now the shortest distances to ech node from the start node `A`. In practice, during the distance calculations we also record the the `previousVertices` for each node to be able to show the exact sequence of nodes that forms the shortest path.
## Implementation example
- [dijkstra.js](./dijkstra.js)
## References ## References
- [Wikipedia](https://en.wikipedia.org/wiki/Dijkstra%27s_algorithm) - [Wikipedia](https://en.wikipedia.org/wiki/Dijkstra%27s_algorithm)