pub struct ShortestPathInfo<T> {
pub distance: f64,
pub paths: Vec<Vec<T>>,
}
impl<T> ShortestPathInfo<T> {
pub fn contains_path_through_node(&self, node_name: T) -> bool
where
T: Eq + Clone,
{
for path in &self.paths {
if path.len() <= 2 {
continue;
}
if path[1..(path.len() - 1)].contains(&node_name) {
return true;
}
}
false
}
}