html

Weighted Graphs

Dijkstra's Algorithm

Weighted graphs are graphs with edges that have a value associated with them. This value is called the weight of the edge.

One of the most famous algorithms for finding the shortest path in a weighted graph is Dijkstra's algorithm. It was invented by Edsger Dijkstra, a Dutch computer scientist.

Dijkstra's algorithm uses a priority queue to keep track of the vertices to visit next.

The algorithm works as follows:

Example use cases include: