use rayon::prelude::*;
use crate::{
HyperedgeTrait,
Hypergraph,
VertexIndex,
VertexTrait,
core::shared::Connection,
errors::HypergraphError,
};
impl<V, HE> Hypergraph<V, HE>
where
V: VertexTrait,
HE: HyperedgeTrait,
{
pub fn get_adjacent_vertices_from(
&self,
from: VertexIndex,
) -> Result<Vec<VertexIndex>, HypergraphError<V, HE>> {
let mut results = self
.get_connections(&Connection::In(from))?
.into_par_iter()
.filter_map(|(_, vertex_index)| vertex_index)
.collect::<Vec<VertexIndex>>();
results.par_sort_unstable();
results.dedup();
Ok(results)
}
}