oxgraph-hyper-bcsr
Directed bipartite-CSR hypergraph views implementing oxgraph-hyper traits.
The first concrete hypergraph layout of the
oxgraph crate family. no_std,
unsafe-free.
What it is
A BcsrHypergraph borrows eight validated CSR slices, one offset/value pair
per direction per role, and implements the storage-agnostic hypergraph
traits from oxgraph-hyper. Bipartite CSR keeps both directions dense: head
and tail participants are stored under a hyperedge-major index, while
outgoing and incoming incidences are stored under a vertex-major index. This
trades roughly four times the participant storage for O(degree) traversal
in either direction, the only access pattern that scales for read-heavy
workloads.
Section payloads are validated at open time. BcsrValidation::Layout covers
lengths, offset monotonicity, in-range IDs, and per-range sorted-and-unique
sequences; it is the default for trusted producers. BcsrValidation::Strict
additionally checks that the hyperedge-major and vertex-major arrays
describe the same incidence set, which is required for end-to-end semantic
guarantees on untrusted inputs.
Where it sits
oxgraph-hyper vertex/hyperedge capability traits
└── oxgraph-hyper-bcsr ← this crate (borrowed bipartite-CSR layout)
├── reads oxgraph-snapshot sections (width-coded kinds)
├── reuses oxgraph-layout-util widths and integrity checks
└── traversed by oxgraph-algo (BFS, PageRank)
Example
Adapted from the runnable example
examples/bcsr_directed.rs
(cargo run -p oxgraph-hyper-bcsr --example bcsr_directed):
use ;
use ;
// Three vertices, two directed hyperedges:
// h0: head={v0} tail={v1, v2}
// h1: head={v1} tail={v2}
let view = open?;
let h0 = new;
let heads: = view.source_participants.collect;
let incident: = view.incident_hyperedges.collect;
Opening the same view from a packed snapshot is
examples/open_bcsr_snapshot.rs,
and building one from data is
examples/yaml_to_hypergraph.rs.
Features
| Feature | Effect |
|---|---|
| none (default) | Borrowed read views only. |
build |
Append-only build::HypergraphBuilder / build::WeightedHypergraphBuilder plus snapshot export helpers. |
build-property-arrow |
Property-snapshot export via oxgraph-property. |
Documentation
See docs.rs/oxgraph-hyper-bcsr for the
full API and the
oxgraph family README for how
the layers fit together. Also available through the umbrella crate:
cargo add oxgraph --features hyper-bcsr (or hyper-build for the
builders).
License
MIT. See LICENSE.