algraph-0.7.0.0: Graph library using adjacency list representation
CopyrightThodoris Papakonstantinou 2017-2026
LicenseLGPL-3
Maintainerdev@tpapak.com
Stabilityexperimental
PortabilityPOSIX
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.Graph.AdjacencyList.WFI

Description

Implementation of the Floyd-Warshall algorithm for computing all-pairs shortest path distances on a weighted or unweighted directed graph. Complexity: O(V^3).

Synopsis

Documentation

newtype Distances Source #

The array containing the distances from vertex to vertex

Constructors

Distances IMArray 

type Weight = Rational Source #

In an unweighted graph the weight is 1 for each edge

type IMArray = IntMap (IntMap Weight) Source #

Two-dimensional distance matrix: vertex → vertex → Weight.

shortestDistances :: Graph -> Distances -> Distances Source #

Get all shortest distances given initial weights on edges

unweightedShortestDistances :: Graph -> Distances Source #

Get all shortest unweighted distances

adjacencyArray :: Graph -> Distances Source #

Build the initial distance matrix from a graph's edges (unit weights). Self-distances are 0; direct edges have distance 1; all others are absent (infinite). Pass the result to shortestDistances to run Floyd-Warshall.