Skip to main content

Crate oxgraph_layout_util

Crate oxgraph_layout_util 

Source
Expand description

Shared layout primitives for OxGraph graph and hypergraph crates.

Three responsibilities live here, one namespace each:

  • Index/word vocabulary (crate root: LayoutIndex, LayoutWord, LayoutSnapshotWord, SnapshotWidth): the single sealed set of dense index widths, native/little-endian storage words, and the width-to-LE-word bijection shared by every layout and snapshot crate. CSR and BCSR add only thin section-kind-bearing sub-traits on top.
  • Build-time (build): validate dense IDs against a known count, convert usize slots back into a typed index width, flatten per-bucket payloads into CSR-style (offsets, items) pairs, and lower native index slices into explicit little-endian words.
  • Read-time (integrity): walk borrowed offset arrays at view-open time and convert already-validated indexes infallibly.

The build and integrity helpers are deliberately not re-exported at the crate root: the root namespace carries only the vocabulary every layer is parameterized over, while builder and validation internals stay behind their module names.

LocalId is the one generic local-handle newtype every layout crate aliases for its node/edge/vertex/hyperedge/incidence identities, and IdSlice is the one slice-to-handle iterator they all reuse.

no_std + alloc (build-time primitives need Vec). No public domain semantics. No dependency on any other oxgraph crate.

Modules§

build
Build-time layout primitives.
integrity
Read-time offset-integrity primitives.

Structs§

EdgeAxis
Relation axis for binary graphs (an edge).
HyperedgeAxis
Relation axis for hypergraphs (a hyperedge).
IdSlice
Iterator that maps a borrowed slice of LayoutWords into axis-branded handles, recovering each logical index and wrapping it with Id::from.
IncidenceAxis
Incidence axis (a participant / endpoint).
LocalId
A dense local handle: an axis-branded index value.
NodeAxis
Element axis for binary graphs (a node).
VertexAxis
Element axis for hypergraphs (a vertex).

Traits§

Axis
Marker for a local-handle axis (node, edge, vertex, hyperedge, incidence).
LayoutIndex
Unsigned dense ID width usable by graph and hypergraph layouts and builders.
LayoutSnapshotWord
A little-endian storage word usable in persisted snapshot payloads.
LayoutWord
A native-host or little-endian word carrying a typed dense LayoutIndex.
SnapshotWidth
A persisted unsigned width with its little-endian storage word.
ZerocopyWord
Borrowed offset or value word usable by offset-integrity primitives.

Functions§

crc32c_append
Continues a CRC-32C (Castagnoli, polynomial 0x1EDC_6F41) checksum over bytes, seeded with the result of a prior call (seed 0 starts a fresh checksum).