hypergraph/core/hyperedges/
get_hyperedge.rs1use crate::{
2 HyperedgeIndex,
3 HyperedgeTrait,
4 Hypergraph,
5 VertexTrait,
6 errors::HypergraphError,
7};
8
9impl<V, HE> Hypergraph<V, HE>
10where
11 V: VertexTrait,
12 HE: HyperedgeTrait,
13{
14 pub(crate) fn get_hyperedge(
16 &self,
17 hyperedge_index: usize,
18 ) -> Result<HyperedgeIndex, HypergraphError<V, HE>> {
19 match self.hyperedges_mapping.left.get(&hyperedge_index) {
20 Some(index) => Ok(*index),
21 None => Err(HypergraphError::InternalHyperedgeIndexNotFound(
22 hyperedge_index,
23 )),
24 }
25 }
26}