Skip to main content

max_degree_vertex

Function max_degree_vertex 

Source
pub fn max_degree_vertex(
    graph: &Graph,
    mode: DegreeMode,
) -> IgraphResult<Option<VertexId>>
Expand description

Returns the vertex (or one of the vertices) with the maximum degree.

Returns None for an empty graph.

ยงExamples

use rust_igraph::{Graph, max_degree_vertex, DegreeMode};

let mut g = Graph::with_vertices(4);
g.add_edge(0, 1).unwrap();
g.add_edge(0, 2).unwrap();
g.add_edge(0, 3).unwrap();
assert_eq!(max_degree_vertex(&g, DegreeMode::All).unwrap(), Some(0));