Expand description
Graph <-> matrix conversions: adjacency (boolean, min-plus, sparse), incidence, and Laplacian, with explicit multiedge policies and a mapping witness.
Structs§
- Graph
Matrix Map - Mapping metadata recording how graph elements landed in the matrix.
Enums§
- Multiedge
Policy - How to collapse parallel edges between the same endpoints into one cell.
Functions§
- graph_
to_ bool_ adjacency - Boolean adjacency:
truewhere at least one edge connects the pair. - graph_
to_ incidence - Incidence matrix as a sparse
IntRingmatrix. Directed:-1at the source,+1at the target. Undirected:+1at both endpoints. One column per edge (self-loops omitted). - graph_
to_ laplacian - Unweighted graph Laplacian
L = D - AoverIntRing, ignoring self-loops. For an undirected graph each row sums to zero. - graph_
to_ minplus_ adjacency - Min-plus weighted adjacency (
Inf= no edge), applying a multiedge policy. - graph_
to_ sparse_ adjacency - Sparse min-plus weighted adjacency, applying a multiedge policy.
- minplus_
adjacency_ to_ graph - Reconstruct a graph from a min-plus adjacency matrix (
Inf= no edge). Node labels are their indices. Directedness is supplied by the caller.