pub fn hrg_fit(
graph: &Graph,
start_hrg: Option<&HrgTree>,
steps: u64,
seed: u64,
) -> IgraphResult<HrgTree>Expand description
Fit a hierarchical random graph model to a network using MCMC.
If start_hrg is provided, the MCMC begins from that dendrogram
structure; otherwise a random initial tree is used.
steps controls the MCMC budget:
- If
steps > 0, exactly that many MCMC moves are performed. - If
steps == 0, the chain runs until convergence (mean log-likelihood stabilizes over 65536-step windows).
§Errors
Returns an error if the graph has fewer than 3 vertices.
§Example
use rust_igraph::{Graph, hrg_fit};
let g = Graph::from_edges(
&[(0,1),(1,2),(2,3),(3,4),(4,0),(0,2),(1,3)],
false, Some(5)
).unwrap();
let hrg = hrg_fit(&g, None, 1000, 42).unwrap();
assert_eq!(hrg.size(), 5);