Documentation

Complexity.Algorithms.WordRAM.Dijkstra.Statement

Dijkstra's algorithm on the word RAM: statements #

This file defines the single-source shortest-path problem solved by Dijkstra's algorithm Dijkstra Cormen et al., Section 24.3.

An instance (Cslib.Algorithms.WordRAM.Dijkstra.Instance) is a directed graph on Fin n with natural-number edge weights, given by its weight matrix, and a source vertex. The distance Cslib.Algorithms.WordRAM.Dijkstra.Instance.dist is the infimum, in ℕ∞, of the weights of the paths (Quiver.Path, Quiver.Path.addWeight) between two vertices; it is ⊤ when there is no path. A program writes a distance as a word with 0 for an unreachable vertex and d + 1 for distance d (Cslib.Algorithms.WordRAM.Dijkstra.encodeDist).

Main definitions #

Main results #

References #

An instance of the single-source shortest-path problem: a directed graph on Fin n with natural-number edge weights, given by its weight matrix, and a source vertex. The entry weight u v is some c for an edge from u to v of weight c, and none for no edge.

  • n : ℕ

    The number of vertices.

  • weight : Fin self.n → Fin self.n → Option ℕ

    The weight matrix.

  • source : Fin self.n

    The source.

Instances For

    The vertices of an instance, as a quiver: an arrow from u to v is a weight c with I.weight u v = some c, so there is at most one.

    Instances For

      The weight of an arrow.

      Instances For

        The shortest-path distance from u to v: the infimum of the weights of the paths from u to v, and ⊤ when there is none.

        Instances For

          Every vertex is at distance 0 from itself, by the empty path.

          The largest edge weight, and 0 when there is no edge.

          Instances For

            A distance as a word: 0 for an unreachable vertex and d + 1 for distance d.

            Instances For