use thiserror::Error;
pub mod algo;
pub mod core;
#[cfg(feature = "macros")]
pub mod macros;
pub mod traits;
#[derive(Debug, Clone, Error)]
pub enum HypergraphErrors {
#[error(
"Wrong edge weight type for a dynamically typed edge. Expected {expected}, found {found}."
)]
EdgeTypeMismatch {
expected: &'static str,
found: &'static str,
},
#[error(
"Edge doesn't have enough nodes. For directed edges,
it must have at least one source and one target. For undirected edges,
it must have at least two nodes."
)]
EdgeTooSmall,
#[error("Algorithm failed due to negative cycle.")]
NegativeCycle,
#[error("Tried to access a node or edge that does not exist.")]
Nonexistent,
#[error("Violates guarantee provided by graph type: {err}")]
InvariantViolation { err: String },
}
pub type HypergraphResult<T> = Result<T, HypergraphErrors>;
pub mod prelude {
pub use crate::core::{
directed::{
DiGraph, Edge as DirectedEdge, Hypergraph as DirectedHypergraph, Node as DirectedNode,
uniform as directed_uniform,
},
special::{complete, cycle_free, cycles, partite},
undirected::{
Edge as UndirectedEdge, Graph, Hypergraph as UndirectedHypergraph,
Node as UndirectedNode, uniform as undirected_uniform,
},
};
#[cfg(feature = "multiplex")]
pub use crate::core::multiplex::{
DirectedLayer, Layer, MultiplexBase, MultiplexGraph, MultiplexIndex, MultiplexNode,
UndirectedLayer, WildcardEdgeType,
};
#[cfg(feature = "temporal")]
pub use crate::core::temporal::{
DirectedTemporalGraph, TemporalBehaviour, UndirectedTemporalGraph,
};
pub use crate::HypergraphErrors;
pub use crate::HypergraphResult;
#[cfg(feature = "macros")]
pub use crate::hypergraph;
pub use crate::traits::*;
pub use crate::{
impl_graph_basics, impl_graph_basics_wrapper, impl_weights, impl_weights_wrapper,
};
}
#[cfg(test)]
mod tests;