Skip to main content

petgraph_live/
lib.rs

1//! `petgraph-live` — graph cache, snapshot, and algorithms for petgraph 0.8.
2//!
3//! # Features
4//!
5//! | Feature | Description |
6//! |---|---|
7//! | *(default)* | [`cache`], [`metrics`], [`connect`], [`shortest_path`], [`mst`], [`hebbian`] |
8//! | `snapshot` | Disk persistence via bincode or JSON |
9//! | `snapshot-zstd` | Zstd compression for snapshots (implies `snapshot`) |
10//! | `snapshot-lz4` | LZ4 compression via `lz4_flex` (implies `snapshot`) |
11//!
12//! Enabling `snapshot` also gates [`live`], which composes the cache with snapshot lifecycle.
13//!
14//! # Quick start
15//!
16//! ```rust
17//! use petgraph_live::cache::GenerationCache;
18//! use std::sync::Arc;
19//!
20//! let cache: GenerationCache<Vec<u32>> = GenerationCache::new();
21//! let g: Arc<Vec<u32>> = cache.get_or_build(1, || Ok::<_, ()>(vec![1, 2, 3])).unwrap();
22//! assert_eq!(*g, vec![1, 2, 3]);
23//! ```
24//!
25//! See [README](https://github.com/geronimo-iia/petgraph-live) for more examples.
26
27pub mod cache;
28pub mod connect;
29pub mod hebbian;
30pub mod metrics;
31pub mod mst;
32pub mod shortest_path;
33
34#[cfg(feature = "snapshot")]
35pub mod snapshot;
36
37#[cfg(feature = "snapshot")]
38pub mod live;