Learn R Programming

mcMST (version 1.1.1)

getRandomSpanningTree: 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)

Value

[matrix] Edge list of spanning tree edges.

Arguments

graph

[grapherator]
Graph.

Examples

Run this code
g = genRandomMCGP(10L)
stree = getRandomSpanningTree(g)

Run the code above in your browser using DataLab