Skip to main content

Module bridge

Module bridge 

Source
Expand description

Graph <-> matrix conversions: adjacency (boolean, min-plus, sparse), incidence, and Laplacian, with explicit multiedge policies and a mapping witness.

Structs§

GraphMatrixMap
Mapping metadata recording how graph elements landed in the matrix.

Enums§

MultiedgePolicy
How to collapse parallel edges between the same endpoints into one cell.

Functions§

graph_to_bool_adjacency
Boolean adjacency: true where at least one edge connects the pair.
graph_to_incidence
Incidence matrix as a sparse IntRing matrix. Directed: -1 at the source, +1 at the target. Undirected: +1 at both endpoints. One column per edge (self-loops omitted).
graph_to_laplacian
Unweighted graph Laplacian L = D - A over IntRing, 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.