ModuleAgda-2.7.0.1Haskell2010
Agda.Utils.Warshall
Construct a graph from constraints
x + n y becomes x ---(-n)--- y
x n + y becomes x ---(+n)--- y
the default edge (= no edge) is labelled with infinity.
Building the graph involves keeping track of the node names. We do this in a finite map, assigning consecutive numbers to nodes.
- 16 types
- 17 values
- PackageAgda-2.7.0.1
- Exports33
- LanguageHaskell2010
- LicenceMIT
- SourceWarshall.hs
Warshall's algorithm on a graph represented as an adjacency list.
Instances5Eq, Ord, Show, Pretty, SemiRing
Nodes of the graph are either
- flexible variables (with identifiers drawn from Int),
- rigid variables (also identified by Ints), or
- constants (like 0, infinity, or anything between).
Which rigid variables a flex may be instatiated to.
isBelow r w r'
checks, if r and r' are connected by w (meaning w not infinite),
whether r + w <= r'.
Precondition: not the same rigid variable.
A constraint is an edge in the graph.
Instances1Pretty
Pretty ConstraintDefined in Agda-2.7.0.1 · Agda.Utils.Warshall
The empty graph: no nodes, edges are all undefined (infinity weight).
The Graph Monad, for constructing a graph iteratively.
Add a size meta node.
Lookup identifier of a node. If not present, it is added first.
addEdge n1 k n2
improves the weight of egde n1->n2 to be at most k.
Also adds nodes if not yet present.
A matrix with row descriptions in b and column descriptions in c.
Instances1Pretty
(Pretty a, Pretty b, Pretty c) => Pretty (LegendMatrix a b c)Defined in Agda-2.7.0.1 · Agda.Utils.Warshall
A solution assigns to each flexible variable a size expression
which is either a constant or a v + n for a rigid variable v.
sizeRigid r n returns the size expression corresponding to r + n