EVOLUTION-MANAGER
Edit File: random_walk.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: Random walk on a graph</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 random_walk {igraph}"><tr><td>random_walk {igraph}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Random walk on a graph</h2> <h3>Description</h3> <p><code>random_walk</code> performs a random walk on the graph and returns the vertices that the random walk passed through. <code>random_edge_walk</code> is the same but returns the edges that that random walk passed through. </p> <h3>Usage</h3> <pre> random_walk( graph, start, steps, mode = c("out", "in", "all", "total"), stuck = c("return", "error") ) random_edge_walk( graph, start, steps, weights = NULL, mode = c("out", "in", "all", "total"), stuck = c("return", "error") ) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>graph</code></td> <td> <p>The input graph, might be undirected or directed.</p> </td></tr> <tr valign="top"><td><code>start</code></td> <td> <p>The start vertex.</p> </td></tr> <tr valign="top"><td><code>steps</code></td> <td> <p>The number of steps to make.</p> </td></tr> <tr valign="top"><td><code>mode</code></td> <td> <p>How to follow directed edges. <code>"out"</code> steps along the edge direction, <code>"in"</code> is opposite to that. <code>"all"</code> ignores edge directions. This argument is ignored for undirected graphs.</p> </td></tr> <tr valign="top"><td><code>stuck</code></td> <td> <p>What to do if the random walk gets stuck. <code>"return"</code> returns the partial walk, <code>"error"</code> raises an error.</p> </td></tr> <tr valign="top"><td><code>weights</code></td> <td> <p>The edge weights. Larger edge weights increase the probability that an edge is selected by the random walker. In other words, larger edge weights correspond to stronger connections. The ‘weight’ edge attribute is used if present. Supply ‘<code>NA</code>’ here if you want to ignore the ‘weight’ edge attribute.</p> </td></tr> </table> <h3>Details</h3> <p>Do a random walk. From the given start vertex, take the given number of steps, choosing an edge from the actual vertex uniformly randomly. Edge directions are observed in directed graphs (see the <code>mode</code> argument as well). Multiple and loop edges are also observed. </p> <h3>Value</h3> <p>For <code>random_walk</code>, a vertex sequence containing the vertices along the walk. For <code>random_edge_walk</code>, an edge sequence containing the edges along the walk. </p> <h3>Examples</h3> <pre> ## Stationary distribution of a Markov chain g <- make_ring(10, directed = TRUE) %u% make_star(11, center = 11) + edge(11, 1) ec <- eigen_centrality(g, directed = TRUE)$vector pg <- page_rank(g, damping = 0.999)$vector w <- random_walk(g, start = 1, steps = 10000) ## These are similar, but not exactly the same cor(table(w), ec) ## But these are (almost) the same cor(table(w), pg) </pre> <hr /><div style="text-align: center;">[Package <em>igraph</em> version 1.3.5 <a href="00Index.html">Index</a>]</div> </body></html>