pub fn neighborhood_graphs_with_mode(
graph: &Graph,
order: i32,
mode: NeighborhoodMode,
mindist: i32,
) -> IgraphResult<Vec<Graph>>Expand description
Per-vertex induced subgraphs of k-hop neighbourhoods with full mode control.
Generalises neighborhood_graphs with direction mode and
mindist filter (minimum distance to include a vertex in the
neighbourhood).
For each source v, collects the set of vertices w with
mindist <= dist(v, w) <= order, then builds the induced subgraph
on that set. Negative order means infinity.
Counterpart of igraph_neighborhood_graphs(graph, _, igraph_vss_all(), order, mode, mindist).
§Errors
IgraphError::InvalidArgumentifmindist < 0.IgraphError::InvalidArgumentiforder >= 0andmindist > order.
§Examples
use rust_igraph::{Graph, neighborhood_graphs_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(); }
let gs = neighborhood_graphs_with_mode(&g, 1, NeighborhoodMode::Out, 0).unwrap();
// Vertex 0's out-1-hop: {0, 1, 2, 3}, induced subgraph has 3 edges
assert_eq!(gs[0].vcount(), 4);
assert_eq!(gs[0].ecount(), 3);
// Vertex 1's out-1-hop: {1} only (no outgoing edges)
assert_eq!(gs[1].vcount(), 1);
assert_eq!(gs[1].ecount(), 0);