1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
use crate::{errors::HypergraphError, Hypergraph, SharedTrait, VertexIndex};
impl<V, HE> Hypergraph<V, HE>
where
V: SharedTrait,
HE: SharedTrait,
{
pub fn get_vertex_weight(
&self,
vertex_index: VertexIndex,
) -> Result<V, HypergraphError<V, HE>> {
let internal_index = self.get_internal_vertex(vertex_index)?;
self.vertices
.get_index(internal_index)
.map(|(weight, _)| *weight)
.ok_or(HypergraphError::InternalVertexIndexNotFound(internal_index))
}
}