pub fn neighborhood_with_mode(
graph: &Graph,
order: i32,
mode: NeighborhoodMode,
mindist: i32,
) -> IgraphResult<Vec<Vec<u32>>>Expand description
Full mode-aware k-hop neighbourhood vertex list with mindist filter.
For each source vertex v returns the list of vertices w such that
mindist <= dist(v, w) <= order (or dist(v, w) >= mindist when
order < 0). The list is in BFS visitation order; when mindist = 0
the source is the first element.
Direction follows mode on directed graphs; on undirected graphs
every mode reduces to NeighborhoodMode::All.
Counterpart of igraph_neighborhood(graph, _, igraph_vss_all(), order, mode, mindist).
§Errors
IgraphError::InvalidArgumentifmindist < 0.IgraphError::InvalidArgumentiforder >= 0andmindist > order.
§Examples
use rust_igraph::{Graph, neighborhood_with_mode, NeighborhoodMode};
// Directed star: 0->1, 0->2, 0->3.
let mut g = Graph::new(4, true).unwrap();
for v in [1, 2, 3] { g.add_edge(0, v).unwrap(); }
// Out from 0: hub reaches all (BFS order: self, then 1, 2, 3).
let nbh = neighborhood_with_mode(&g, -1, NeighborhoodMode::Out, 0).unwrap();
assert_eq!(nbh[0], vec![0, 1, 2, 3]);
// Leaves stay alone.
assert_eq!(nbh[1], vec![1]);
// mindist=1 strips the source.
let nbh1 = neighborhood_with_mode(&g, 1, NeighborhoodMode::All, 1).unwrap();
assert_eq!(nbh1[0].len(), 3); // 1, 2, 3 (some order)
assert!(!nbh1[0].contains(&0));