rshyper_algo/traits/search.rs
1/*
2 appellation: search <module>
3 authors: @FL03
4*/
5use super::Traversal;
6use crate::error::Result;
7
8/// The [`Search`] establishes a common interface for operators on hypergraphs capable of
9/// performing a search.
10pub trait Search<N> {
11 type Output;
12
13 /// begins a search of the graph, starting with the given index.
14 fn search(&mut self, start: N) -> Result<Self::Output>;
15}
16/// The [`GraphSearch`] trait is an automatically implemented trait for types that implement
17/// both the [`Search`] and [`Traversal`] traits indicating it can successfully perform a
18/// search on some graph structure while also allowing traversal of the graph.
19pub trait GraphSearch<Idx>: Search<Idx> + Traversal<Idx> {
20 private!();
21}
22
23/*
24 ************* Implementations *************
25*/
26impl<T, Idx> GraphSearch<Idx> for T
27where
28 T: Search<Idx> + Traversal<Idx>,
29{
30 seal!();
31}