getRandomSpanningTree {mcMST}R 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)

[Package mcMST version 1.1.1 Index]