Description Usage Arguments Value Examples
View source: R/generate_random_walk.R
Generate a random walk around a graph. Does *not* factor edge weights into the walk (i.e., will transition to any successor node with equal probability).
1 | generate_random_walk(input_tidygraph, n_obs, start_here = NULL)
|
input_tidygraph |
A 'tbl_graph' representation from 'tidygraph'. This function may not work with other kinds of network representations, e.g. from 'igraph'. Make sure that your input graph is either directed or undirected, as you'd like it. |
n_obs |
Number of observations (i.e., steps in the random walk). |
start_here |
Numeric node ID. By default, picks a random starting point. |
A tibble containing all observations.
1 2 3 4 | `%>%` <- magrittr::`%>%`
successr::karate %>%
tidygraph::as_tbl_graph(directed = F) %>%
generate_random_walk(100)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.