pub fn random_spanning_tree<N, E, Ix, R>(
graph: &Graph<N, E, Ix>,
rng: &mut R,
) -> Result<Graph<N, E, Ix>>Expand description
Generates a random spanning tree from an existing graph
Uses Kruskal’s algorithm with randomized edge selection to produce a random spanning tree of the input graph.
§Arguments
graph- The input graph to extract a spanning tree fromrng- Random number generator
§Returns
Result<Graph<N, E>>- A spanning tree of the input graph