rshyper_core/
lib.rs

1/*
2    appellation: rshyper-core <library>
3    authors: @FL03
4*/
5//! # rshyper-core
6//!
7//! This crate provides the core functionality for the rshyper library, implementing various
8//! primitives and utilities for working with hypergraphs.
9//!
10//! ## Components
11//!
12//! - [`attrs`]: Contains the [`Attrs`] and [`GraphProps`] types for managing graph attributes.
13//! - [`edge`]: implements the [`Edge`] and [`Surface`] types for representing hyperedges
14//! - [`node`]: provides the [`Node`] implementation for representing hypernodes
15//! - [`weight`]: gives the [`Weight`] type for representing weights in a hypergraph
16//!
17#![crate_type = "lib"]
18#![doc(
19    html_logo_url = "https://raw.githubusercontent.com/FL03/rshyper/main/.artifacts/assets/logo.svg",
20    html_favicon_url = "https://raw.githubusercontent.com/FL03/rshyper/main/.artifacts/assets/logo.svg"
21)]
22#![allow(
23    clippy::should_implement_trait,
24    clippy::module_inception,
25    clippy::missing_safety_doc
26)]
27#![cfg_attr(not(feature = "std"), no_std)]
28#![cfg_attr(feature = "nightly", feature(allocator_api))]
29#[cfg(feature = "alloc")]
30extern crate alloc;
31
32#[macro_use]
33pub(crate) mod macros {
34    #[macro_use]
35    pub mod seal;
36}
37
38#[doc(inline)]
39pub use self::{
40    attrs::{Attrs, GraphProps},
41    edge::Edge,
42    error::{Error, Result},
43    idx::prelude::*,
44    node::Node,
45    rel::{Link, RawLayout},
46    traits::prelude::*,
47    types::*,
48    weight::prelude::*,
49};
50
51pub mod attrs;
52pub mod edge;
53pub mod error;
54pub mod idx;
55pub mod node;
56pub mod rel;
57pub mod weight;
58
59pub mod traits {
60    //! this module contains various traits used throughout to establish common interfaces and
61    //! behaviors
62    #[doc(inline)]
63    pub use self::prelude::*;
64    /// the [`Contains`] trait provides a way to check if a graph contains a specific component
65    mod contains;
66    /// this module implements the [`RawDomain`] trait for defining the type of collection used
67    /// to compose the hyperedge
68    mod domain;
69    /// the [`HyperGraph`] trait defines the core interface for hypergraphs, enabling the
70    /// generalization of algorithms constructors, and graphical operators.
71    #[cfg(feature = "alloc")]
72    mod hyper_graph;
73    /// the [`Merge`] trait provides a way to combine two graphs into one
74    mod merge;
75    /// this module defines sequential step generators
76    mod step;
77    /// traits for transformative operations on hypergraphs, such as mapping, are implemented
78    /// within this module
79    mod transform;
80
81    pub(crate) mod prelude {
82        #[doc(inline)]
83        pub use super::contains::*;
84        #[doc(inline)]
85        pub use super::domain::*;
86        #[doc(inline)]
87        #[cfg(feature = "alloc")]
88        pub use super::hyper_graph::*;
89        #[doc(inline)]
90        pub use super::merge::*;
91        #[doc(inline)]
92        pub use super::step::*;
93        #[doc(inline)]
94        pub use super::transform::*;
95    }
96}
97
98pub mod types {
99    //! this module provides various types used throughout the library
100    #[doc(inline)]
101    pub use self::prelude::*;
102    /// this module defines the two types of graph kinds: [`Directed`] and [`Undirected`]
103    mod graph_kind;
104
105    pub(crate) mod prelude {
106        #[doc(inline)]
107        pub use super::graph_kind::*;
108    }
109}
110
111pub mod prelude {
112    // pub use crate::error::*;
113
114    pub use crate::attrs::prelude::*;
115    pub use crate::edge::prelude::*;
116    pub use crate::idx::prelude::*;
117    pub use crate::node::prelude::*;
118    pub use crate::rel::prelude::*;
119    pub use crate::traits::prelude::*;
120    pub use crate::types::prelude::*;
121    pub use crate::weight::prelude::*;
122}