Skip to main content

murmuration_routing/
lib.rs

1//! # murmuration-routing
2//!
3//! A small, dependency-light toolkit for **evaluating delay-tolerant (mesh)
4//! routing** — extracted from the [murmuration](https://github.com/borisgraudt/murmuration)
5//! mesh network so it can be reused and cited on its own.
6//!
7//! It contains both the learned routers and the substrate to evaluate them:
8//!
9//! * [`Router`] — adaptive next-hop selection: a **UCB1 bandit**
10//!   ([`Router::get_best_forward_peers`]) plus **Q-routing** value bootstrapping
11//!   ([`Router::q_select_toward`], [`Router::q_advertised_value`],
12//!   [`Router::q_record`]). Learned state persists through an optional
13//!   [`RouterStore`], so the crate itself does no I/O.
14//! * [`peer`] — the observable peer types a routing decision reads
15//!   ([`peer::PeerInfo`], [`peer::PeerMetrics`]).
16//! * [`trace::ContactTrace`] — contact traces for delay-tolerant evaluation:
17//!   load a real CRAWDAD/Infocom CSV ([`trace::ContactTrace::load_csv`]) or
18//!   generate one with **heavy-tailed (power-law) inter-contact times**
19//!   ([`trace::ContactTrace::synthetic`]), matching human mobility (Chaintreau
20//!   et al., 2007).
21//! * [`trace::ContactTrace::earliest_arrival`] — the exact *foremost journey*
22//!   (Bui-Xuan et al., 2003): the oracle any store-carry-forward scheme is
23//!   measured against.
24//!
25//! See the repository's `results/RESULTS.md` for the study these tools produced:
26//! bandit routing has a destination-agnostic ceiling, and Q-routing breaks it.
27//!
28//! ```
29//! use murmuration_routing::trace::ContactTrace;
30//!
31//! // A reproducible synthetic trace: 20 nodes, ~1 day, power-law gaps.
32//! let t = ContactTrace::synthetic(20, 86_400.0, 0.5, 30.0, 0.5, /*seed*/ 1);
33//! let arrival = t.earliest_arrival(/*src*/ 0, /*t0*/ 0.0);
34//! assert_eq!(arrival[0], 0.0); // the source is reachable at t0 by definition
35//! ```
36
37pub mod error;
38pub mod peer;
39pub mod router;
40pub mod routing_logger;
41pub mod stats;
42pub mod trace;
43
44pub use router::{MeshMessage, MurmurationAddress, Router, RouterStore};