Skip to main content

independent_set_count_sequence

Function independent_set_count_sequence 

Source
pub fn independent_set_count_sequence(graph: &Graph) -> IgraphResult<Vec<u64>>
Expand description

Compute the independence polynomial coefficient sequence.

Returns [i(G,0), i(G,1), ..., i(G,n)] where i(G,k) is the number of independent sets of size k. Trailing zeros are trimmed. i(G,0) = 1 always (the empty set).

§Examples

use rust_igraph::{Graph, independent_set_count_sequence};

// K_3 (triangle): {}, {0}, {1}, {2} → [1, 3]
let g = Graph::from_edges(&[(0,1),(1,2),(0,2)], false, Some(3)).unwrap();
assert_eq!(independent_set_count_sequence(&g).unwrap(), vec![1, 3]);