pub fn weighted_clique_number(
graph: &Graph,
vertex_weights: &[f64],
) -> IgraphResult<f64>Expand description
Returns the weight of the maximum-weight clique.
The weight of a clique is the sum of its vertex weights. Only positive integer vertex weights are supported; following igraph, each weight is truncated to its integer part. Because every weight is positive, the maximum-weight clique is always maximal, so the search ranges over maximal cliques.
vertex_weights must have one entry per vertex. For an empty graph the
weight is 0.0. This is the counterpart of igraph’s
igraph_weighted_clique_number.
Edge directions are ignored for directed graphs.
§Errors
Returns IgraphError::InvalidArgument if vertex_weights has the wrong
length or any (truncated) weight is not a positive integer.
§Examples
use rust_igraph::{Graph, weighted_clique_number};
let mut g = Graph::with_vertices(4);
g.add_edge(0, 1).unwrap();
g.add_edge(0, 2).unwrap();
g.add_edge(1, 2).unwrap();
g.add_edge(2, 3).unwrap();
// {2,3} has weight 1 + 5 = 6, beating the triangle's weight 3.
let w = weighted_clique_number(&g, &[1.0, 1.0, 1.0, 5.0]).unwrap();
assert!((w - 6.0).abs() < 1e-9);