rshyper_algo/
lib.rs

1/*
2    Appellation: algo <library>
3    Contrib: @FL03
4*/
5//! # rshyper-algo
6//!
7//! this crate provides algorithms and operators for hypergraphs.
8//!
9//! ## Features
10//!
11//! - [`astar`]: the A* search algorithm for hypergraphs
12//! - [`breadth_first`]: the breadth-first search algorithm for hypergraphs
13//! - [`depth_first`]: the depth-first search algorithm for hypergraphs
14//! - [`dijkstra`]: Dijkstra's algorithm for finding the shortest path in hypergraphs
15//!
16#![crate_type = "lib"]
17#![doc(
18    html_logo_url = "https://raw.githubusercontent.com/FL03/rshyper/main/.artifacts/assets/logo.svg",
19    html_favicon_url = "https://raw.githubusercontent.com/FL03/rshyper/main/.artifacts/assets/logo.svg"
20)]
21#![allow(
22    clippy::missing_safety_doc,
23    clippy::module_inception,
24    clippy::needless_doctest_main,
25    clippy::non_canonical_clone_impl,
26    clippy::non_canonical_partial_ord_impl,
27    clippy::should_implement_trait
28)]
29#![cfg_attr(not(feature = "std"), no_std)]
30#![cfg_attr(feature = "nightly", feature(allocator_api))]
31
32#[cfg(feature = "alloc")]
33extern crate alloc;
34
35extern crate rshyper_core as rshyper;
36
37#[macro_use]
38pub(crate) mod macros {
39    #[macro_use]
40    pub mod seal;
41}
42
43#[doc(inline)]
44pub use self::traits::prelude::*;
45#[cfg(feature = "std")]
46pub use self::{
47    astar::AStarSearch, breadth_first::BreadthFirstTraversal, depth_first::DepthFirstTraversal,
48    dijkstra::Dijkstra,
49};
50
51#[cfg(feature = "std")]
52pub mod astar;
53#[cfg(feature = "std")]
54/// this module implements the breadth-first search algorithm
55pub mod breadth_first;
56#[cfg(feature = "std")]
57/// this module implements the depth-first search algorithm
58pub mod depth_first;
59#[cfg(feature = "std")]
60/// this module implements the Dijkstra's algorithm for finding the shortest path in a hypergraph
61pub mod dijkstra;
62
63pub mod error;
64
65pub mod traits {
66    //! this module implements additional traits for defining algorithmic operators on
67    //! hypergraphs.
68    #[doc(inline)]
69    pub use self::prelude::*;
70    /// this module defines the [`Heuristic`] trait for heuristic functions
71    mod heuristic;
72    /// this module defines the [`Operator`] trait for establishing a common interface for all
73    /// algorithmic operators on a hypergraph.
74    mod operators;
75    /// this module defines the interface for path-finding algorithms on hypergraphs, [`PathFinder`].
76    mod path;
77    /// this module defines the [`Search`] trait for all implemented search algorithms on a
78    /// hypergraph.
79    mod search;
80    /// this module defines the [`Traversal`] trait for traversing hypergraphs.
81    mod traverse;
82
83    pub(crate) mod prelude {
84        #[doc(inline)]
85        pub use super::heuristic::*;
86        #[doc(inline)]
87        pub use super::operators::*;
88        #[doc(inline)]
89        pub use super::path::*;
90        #[doc(inline)]
91        pub use super::search::*;
92        #[doc(inline)]
93        pub use super::traverse::*;
94    }
95}
96
97#[doc(hidden)]
98pub mod prelude {
99    pub use crate::traits::prelude::*;
100
101    #[cfg(feature = "alloc")]
102    pub use crate::astar::AStarSearch;
103    #[cfg(feature = "alloc")]
104    pub use crate::breadth_first::BreadthFirstTraversal;
105    #[cfg(feature = "alloc")]
106    pub use crate::depth_first::DepthFirstTraversal;
107    #[cfg(feature = "alloc")]
108    pub use crate::dijkstra::Dijkstra;
109}