oxgraph-graph
Storage-agnostic core traits for binary graph views.
The binary graph specialization of the
oxgraph crate family. no_std,
unsafe-free.
What it is
oxgraph-graph sits directly above oxgraph-topology and renames its
vocabulary for ordinary directed graphs: topology elements become nodes,
topology relations become edges. Use it to write generic graph consumers over
node/edge vocabulary: endpoint lookup, outgoing traversal, incoming
traversal, and degree queries.
Most traits and aliases in this crate are graph-vocabulary shadows of
topology traits, and they inherit their performance contracts from the
traits they shadow: O(1) for accessors, O(1) to construct an iterator
plus O(k) to yield k items. Concrete layouts, snapshots, builders,
mutation systems, payloads, and algorithms live in higher-level crates that
implement or consume these read-view capabilities.
Where it sits
oxgraph-topology capability traits
└── oxgraph-graph ← this crate (node/edge vocabulary)
├── oxgraph-csr borrowed CSR layout (outgoing)
├── oxgraph-csc borrowed CSC layout (inbound)
└── oxgraph-algo BFS and PageRank over these traits
Example
Generic code asks for the capabilities it needs and works with any view that provides them:
use ;
// `graph` is any view implementing the graph capability traits.
println!;
println!;
for edge in graph.outgoing_edges
A complete implementation of these traits for a tiny directed graph is the
runnable example
examples/graph_directed.rs:
cargo run -p oxgraph-graph --example graph_directed.
Documentation
See docs.rs/oxgraph-graph 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 graph.
License
MIT. See LICENSE.