pub fn hrg_consensus(
graph: &Graph,
start_hrg: Option<&HrgTree>,
num_samples: u64,
seed: u64,
) -> IgraphResult<(Vec<i32>, Vec<f64>)>Expand description
Compute a consensus tree from MCMC samples of HRG models.
Returns (parents, weights):
parents[i]is the parent of vertex i in the consensus tree (-1 for root). Vertex IDs 0..n are leaves, n..2n-1 are internal.weights[i]is the frequency (0..1) of each internal split.
§Errors
Returns an error if the graph has fewer than 3 vertices.
§Example
use rust_igraph::{Graph, hrg_consensus};
let g = Graph::from_edges(
&[(0,1),(1,2),(2,3),(3,4),(4,0),(0,2)],
false, Some(5)
).unwrap();
let (parents, weights) = hrg_consensus(&g, None, 10, 42).unwrap();
assert_eq!(parents.len(), 2 * 5 - 1);
assert_eq!(weights.len(), 4); // n-1 internal nodes