random_walk_restart | R Documentation |
This function performs a propagation analysis by random walk with restart in a multi-layered network from specific seeds.
random_walk_restart(X, seed = NULL, r = 0.7)
X |
an igraph or list.igraph object. |
seed |
a character vector. Only seeds present in X are considered. |
r |
a numeric value between 0 and 1. It sets the probability of restarting to a seed node after each step. |
Each element of X returns a list (class = 'rwr') containing the following elements:
rwr |
a |
seed |
a character vector with the valid seeds |
graph |
|
If X is a list.igraph
, the returned object is a list.rwr
.
rwr_find_seeds_between_attributes
,
rwr_find_closest_type
graph1 <- igraph::graph_from_data_frame(
list(from = c('A', 'B', 'A', 'D', 'C', 'A', 'C'),
to = c('B', 'C', 'D', 'E', 'D', 'F', 'G')),
directed = FALSE)
graph1 <- igraph::set_vertex_attr(graph = graph1,
name = 'type',
index = c('A','B','C'),
value = '1')
graph1 <- igraph::set_vertex_attr(graph = graph1,
name = 'type',
index = c('D','E'),
value = '2')
graph1 <- igraph::set_vertex_attr(graph = graph1,
name = 'type',
index = c('F', 'G'),
value = '3')
rwr_res <- random_walk_restart(X = graph1,
seed = c('A', 'B', 'C', 'D', 'E'))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.