EVOLUTION-MANAGER
Edit File: sample_tree.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Sample trees randomly and uniformly</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for sample_tree {igraph}"><tr><td>sample_tree {igraph}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Sample trees randomly and uniformly</h2> <h3>Description</h3> <p><code>sample_tree</code> generates a random with a given number of nodes uniform at random from the set of labelled trees. </p> <h3>Usage</h3> <pre> sample_tree(n, directed = FALSE, method = c("lerw", "prufer")) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>n</code></td> <td> <p>The number of nodes in the tree</p> </td></tr> <tr valign="top"><td><code>directed</code></td> <td> <p>Whether to create a directed tree. The edges of the tree are oriented away from the root.</p> </td></tr> <tr valign="top"><td><code>method</code></td> <td> <p>The algorithm to use to generate the tree. ‘prufer’ samples Prufer sequences uniformly and then converts the sampled sequence to a tree. ‘lerw’ performs a loop-erased random walk on the complete graph to uniformly sampleits spanning trees. (This is also known as Wilson's algorithm). The default is ‘lerw’. Note that the method based on Prufer sequences does not support directed trees at the moment.</p> </td></tr> </table> <h3>Details</h3> <p>In other words, the function generates each possible labelled tree with the given number of nodes with the same probability. </p> <h3>Value</h3> <p>A graph object. </p> <h3>Examples</h3> <pre> g <- sample_tree(100, method="lerw") </pre> <hr /><div style="text-align: center;">[Package <em>igraph</em> version 1.3.5 <a href="00Index.html">Index</a>]</div> </body></html>