Skip to main content

Crate dijkstra

Crate dijkstra 

Source
Expand description

Dijkstra’s single-source shortest path on a weighted graph.

Given a directed or undirected graph with non-negative edge weights, Dijkstra’s algorithm computes the shortest distance from a source vertex to every other reachable vertex in O((V + E) log V) time using a binary heap.

This module exposes a single function dijkstra that takes the adjacency list as &[Vec<(usize, u64)>] (each edge is (neighbor, weight)) and returns a HashMap<usize, u64> of minimum distances.

Functions§

dijkstra
Compute shortest distances from source to every reachable vertex.