bit_gossip/
lib.rs

1//! Pathfinding library for calculating all node pairs' shortest paths in an unweighted undirected graph.
2//!
3//! See [prim] and [graph] modules for more information.
4//!
5//! ## Features
6//!
7//! - **parallel**: Enable parallelism using Rayon; this feature is enabled by default.
8
9pub mod prim;
10pub use prim::{
11    Graph128, Graph128Builder, Graph16, Graph16Builder, Graph32, Graph32Builder, Graph64,
12    Graph64Builder,
13};
14
15pub mod graph;
16pub use graph::{Graph, GraphBuilder};
17
18pub mod bitvec;
19pub mod maze;
20
21/// Given two node IDs, return a tuple of the two IDs in ascending order.
22#[inline]
23pub fn edge_id<T: Ord>(node_a_index: T, node_b_index: T) -> (T, T) {
24    if node_a_index > node_b_index {
25        (node_b_index, node_a_index)
26    } else {
27        (node_a_index, node_b_index)
28    }
29}