triversity (version 1.0)

get_distribution_from_path: Compute the probability distribution associated to a random walk following a path between the levels of a tripartite graph.

Description

get_distribution_from_path computes the probability distribution of a random walk within the different levels of the input tripartite graph. It starts at a given level with an initial probability distribution, then randomly follows the links of the graph between the different levels according to the input path, then stops at the last specified level.

Usage

get_distribution_from_path(tripartite, path, initial_distribution = NULL,
  initial_node = NULL)

Arguments

tripartite

A tripartite graph obtained by calling the get_tripartite function.

path

A vector of integers in {1, 2, 3} giving the path of the random walk between the different levels of the input tripartite graph. This path can be as long as wanted. Two successive levels should always be adjacent, that is the random walk cannot go from level 1 to level 3 (or conversely) without first going through level 2.

initial_distribution

A vector of floats in [0,1] and summing to 1 giving the probability distribution to start with at the first level of the input path. It should hence contain as many values as there are nodes in the corresponding level. If not specified, this distribution is assumed uniform.

initial_node

A string giving the name of a node in the first level of the input path. This node is then considered to have probability one, thus being equivalent to specifying an initial_distribution with only zeros except for one node. If not specified, no such node is defined and the initial distribution is assumed uniform.

Value

A vector of floats in [0,1] and summing to 1 giving the probability distribution of the random walk when arriving at the last level, after having followed the input path within the different levels of the graph.

Examples

Run this code
# NOT RUN {
data (tripartite_example)
tripartite <- get_tripartite (data=tripartite_example)

get_distribution_from_path (tripartite, path=c(2,1,2,3))
get_distribution_from_path (tripartite, path=c(2,1,2,3), initial_distribution=c(0.25,0,0.25,0.5))
get_distribution_from_path (tripartite, path=c(2,1,2,3), initial_node='i2')

# }

Run the code above in your browser using DataLab