generate_random_walk: Random walk around a graph

Description Usage Arguments Value Examples

View source: R/generate_random_walk.R

Description

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).

Usage

1
generate_random_walk(input_tidygraph, n_obs, start_here = NULL)

Arguments

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.

Value

A tibble containing all observations.

Examples

1
2
3
4
`%>%` <- magrittr::`%>%`
successr::karate %>%
    tidygraph::as_tbl_graph(directed = F) %>%
    generate_random_walk(100)

psychNerdJae/successr documentation built on Dec. 22, 2021, 9:56 a.m.