Skip to main content

graph_periphery

Function graph_periphery 

Source
pub fn graph_periphery(
    graph: &Graph,
    mode: EccMode,
) -> IgraphResult<Vec<VertexId>>
Expand description

Return the periphery vertices of a graph.

A vertex belongs to the periphery if its eccentricity equals the graph diameter (maximum eccentricity). For directed graphs, mode controls BFS direction.

Returns an empty vector for an empty graph.

ยงExamples

use rust_igraph::{Graph, graph_periphery, EccMode};

// Path 0-1-2-3-4: periphery is {0, 4} (eccentricity 4 = diameter)
let g = Graph::from_edges(&[(0,1),(1,2),(2,3),(3,4)], false, Some(5)).unwrap();
let peri = graph_periphery(&g, EccMode::All).unwrap();
assert_eq!(peri, vec![0, 4]);