random_walk_restart: Random Walk with Restart

View source: R/RWR.R

random_walk_restartR Documentation

Random Walk with Restart

Description

This function performs a propagation analysis by random walk with restart in a multi-layered network from specific seeds.

Usage

random_walk_restart(X, seed = NULL, r = 0.7)

Arguments

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.

Value

Each element of X returns a list (class = 'rwr') containing the following elements:

rwr

a data.frame, the RWR results for each valid seed.

seed

a character vector with the valid seeds

graph

igraph object from X

If X is a list.igraph, the returned object is a list.rwr.

See Also

rwr_find_seeds_between_attributes, rwr_find_closest_type

Examples

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


abodein/netOmics documentation built on Oct. 20, 2024, 9:25 a.m.