Skip to main content

helix_graph_algorithms/
lib.rs

1//! Storage-independent graph representation and native graph algorithms.
2//!
3//! The crate deliberately has no dependency on Helix storage, query planning,
4//! async runtimes, or SDK bindings. SDKs query Helix once, construct a
5//! validated [`Graph`], and reuse that immutable graph for any number of local
6//! algorithms.
7//!
8//! ```
9//! use helix_graph_algorithms::{Edge, Graph, GraphKind, Node};
10//!
11//! let graph = Graph::new(
12//!     GraphKind::DiGraph,
13//!     [Node::new("a"), Node::new("b")],
14//!     [Edge::new("ab", "a", "b")],
15//! )?;
16//! assert_eq!(graph.node_count(), 2);
17//! assert_eq!(graph.edge_count(), 1);
18//! # Ok::<(), helix_graph_algorithms::GraphError>(())
19//! ```
20
21mod algorithms;
22mod identity;
23pub mod loader;
24mod model;
25mod transform;
26
27pub use algorithms::{
28    BetweennessMode, BetweennessOptions, Community, CommunityResult, Cycle, CycleOptions,
29    CycleResult, DegreeKind, EdgeScore, EdgeTraversalDirection, HubExpansionPolicy, LayoutOptions,
30    LeidenOptions, LeidenResult, LouvainOptions, NodeDegree, NodePosition, NodeScore, PathEdge,
31    PathResult, PathWeight, TraversalDirection, TraversalOptions, TraversalResult,
32    TraversalStrategy, TraversedEdge, Visit,
33};
34pub use identity::{ExternalId, GraphProperty, IdentitySelection};
35pub use model::{
36    Attributes, Edge, EdgeId, Graph, GraphError, GraphKind, Node, NodeId, NonNegativeFiniteF64,
37    PositiveFiniteF64,
38};