getRandomSpanningTree: Generate random spanning tree.

View source: R/getRandomSpanningTree.R

getRandomSpanningTreeR Documentation

Generate random spanning tree.

Description

Given a grapherator object this function returns a random spanning tree. The tree generation process is a simple heuristic: A random weight from a U(0, 1)-distribution is assigned to each edge of the graph. Next, a spanning tree is computed by spantree.

Usage

getRandomSpanningTree(graph)

Arguments

graph

[grapherator]
Graph.

Value

[matrix] Edge list of spanning tree edges.

Note

Most likely this heuristic does not produce each spanning tree with equal probability.

Examples

g = genRandomMCGP(10L)
stree = getRandomSpanningTree(g)

mcMST documentation built on April 1, 2023, 12:19 a.m.