Expand description
Route-finding algorithms. Includes MostLiquidAlgorithm,
algorithm::BellmanFordAlgorithm, PathFrankWolfeAlgorithm,
algorithm::WaterFillAlgorithm, and the pluggable Algorithm trait.
Route-finding algorithms.
This module defines the Algorithm trait and built-in implementations. New algorithms can be added by implementing the trait.
Algorithms are generic over their preferred graph type, allowing them to use different graph crates (petgraph, custom, etc.) and leverage built-in algorithms.
§Adding a New Algorithm
External: Implement the Algorithm trait in your own crate and plug it
into a WorkerPoolBuilder via
with_algorithm. No changes
to fynd-core required. See the custom_algorithm example.
Built-in: To add an algorithm to the built-in registry:
- Create a new module with your algorithm implementation
- Implement the
Algorithmtrait - Register it in
worker_pool/registry.rs
From outside this crate: implement the trait and bring it in with
AlgorithmRegistry; no change here is needed.
Re-exports§
pub use bellman_ford::BellmanFordAlgorithm;pub use most_liquid::MostLiquidAlgorithm;pub use path_frank_wolfe::PathFrankWolfeAlgorithm;pub use registry::AlgorithmRegistry;pub use registry::RegisterAlgorithmError;pub use request::SolveParts;pub use request::SolveRequest;pub use water_fill::WaterFillAlgorithm;
Modules§
- bellman_
ford - Bellman-Ford algorithm with SPFA optimization for simulation-driven routing.
- most_
liquid - Most Liquid algorithm implementation.
- path_
frank_ wolfe - Path-based Frank-Wolfe split-routing algorithm.
- paths
- Enumerating and simulating routes between two tokens. Finding, ranking and simulating routes that name a pool for every leg.
- registry
- Custom
Algorithmimplementations, held by name. - request
- What an algorithm is given to solve one order. What an algorithm is given to solve one order.
- sim_
meter - Measurement of the simulation work one solve does.
- split_
primitives - Shared machinery for algorithms that divide an order across several paths.
- swap_
cache - Remembers what a pool paid, so one solve asks it once per amount.
- water_
fill - Water-fill split-routing algorithm (
water_fill).
Structs§
- Algorithm
Config - Configuration for an Algorithm instance.
Enums§
- Algorithm
Error - Errors that can occur during route finding.
- NoPath
Reason - Reason why no path was found between tokens.
Traits§
- Algorithm
- Trait for route-finding algorithms.