HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Modulefgl-5.8.2.0Haskell98

Data.Graph.Inductive.Query.SP

Shortest path algorithms

  • 2 types
  • 4 values
  • Packagefgl-5.8.2.0
  • Exports6
  • LanguageHaskell98
  • LicenceBSD-3-Clause
  • SourceSP.hs
valuespTree :: (Graph gr, Real b) => Node -> gr a b -> LRTree b
#

Tree of shortest paths from a certain node to the rest of the (reachable) nodes.

Corresponds to dijkstra applied to a heap in which the only known node is the starting node, with a path of length 0 leading to it.

The edge labels of type b are the edge weights; negative edge weights are not supported.

valuesp
  1. :: (Graph gr, Real b)
  2. => Node

    Start

  3. -> Node

    Destination

  4. -> gr a b
  5. -> Maybe Path
#

Shortest path between two nodes, if any.

Returns Nothing if the destination is not reachable from the start node, and Just path otherwise.

The edge labels of type b are the edge weights; negative edge weights are not supported.

valuespLength
  1. :: (Graph gr, Real b)
  2. => Node

    Start

  3. -> Node

    Destination

  4. -> gr a b
  5. -> Maybe b
#

Length of the shortest path between two nodes, if any.

Returns Nothing if there is no path, and Just length otherwise.

The edge labels of type b are the edge weights; negative edge weights are not supported.

valuedijkstra
  1. :: (Graph gr, Real b)
  2. => Heap b (LPath b)

    Initial heap of known paths and their lengths.

  3. -> gr a b
  4. -> LRTree b
#

Dijkstra's shortest path algorithm.

The edge labels of type b are the edge weights; negative edge weights are not supported.

datadata Heap a b
#
Instances4Eq, Read, Show, NFData
  • (Eq a, Eq b) => Eq (Heap a b)Defined in fgl-5.8.2.0 · Data.Graph.Inductive.Internal.Heap
  • (Read a, Read b) => Read (Heap a b)Defined in fgl-5.8.2.0 · Data.Graph.Inductive.Internal.Heap
  • (Show a, Show b) => Show (Heap a b)Defined in fgl-5.8.2.0 · Data.Graph.Inductive.Internal.Heap
  • (NFData a, NFData b) => NFData (Heap a b)Defined in fgl-5.8.2.0 · Data.Graph.Inductive.Internal.Heap