haccepted-0.1.0.0: Data structures and algorithms
Safe HaskellNone
LanguageHaskell2010

Dijkstra

Description

Dijkstra's algorithm

An algorithm to find multi-source shortest paths in a graph with non-negative edges.

There are a variety of possible implementations depending on what is required, such as finding parents, early stopping, etc. This is a basic implementation calculating only the distances, to be modified when required.

Sources:

Synopsis

Documentation

dijkstra :: LGraph Weight -> [Vertex] -> UArray Vertex Weight Source #

Runs Dijkstra's algorithm on the given graph. Unreachable vertices have distance maxBound. O((V + E) log V).

dijkstraH :: LGraph Weight -> [Vertex] -> UArray Vertex Weight Source #

Runs Dijkstra's algorithm on the given graph. srcs should not have duplicates. Unreachable vertices have distance maxBound. Faster than dijkstra, especially for large sparse graphs. O((V + E) log E).