Dijkstra's Algorithm

Introduction

Dijkstra's algorithm is used to find the shortest path between nodes in a graph.

How It Works

Step-by-Step Process

  1. Initialize distances and priority queue.
  2. While the queue is not empty, extract the node with the smallest distance.
  3. Update distances to neighboring nodes.
  4. Repeat until all nodes have been processed.

Example

Dijkstra animation

Learn more: Wikipedia