pub fn independence_number(graph: &Graph) -> IgraphResult<u32>Expand description
Returns the independence number of the graph (size of the largest independent set).
An independent set is a set of vertices with no edges between them. Equivalently, it is a clique in the complement graph. For a graph with no edges, the independence number equals the vertex count.
Edge directions are ignored for directed graphs.
ยงExamples
use rust_igraph::{Graph, independence_number};
// Path 0-1-2: largest independent set is {0, 2}
let mut g = Graph::with_vertices(3);
g.add_edge(0, 1).unwrap();
g.add_edge(1, 2).unwrap();
assert_eq!(independence_number(&g).unwrap(), 2);