get_distribution_from_path: Compute the probability distribution associated to a random...

Description Usage Arguments Value Examples

Description

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

Usage

1
2
get_distribution_from_path(graph, path, initial_distribution = NULL,
  initial_node = NULL)

Arguments

graph

A multipartite graph obtained by calling the get_multipartite function.

path

A vector of character strings giving the path that the random walk should follow between the different parts of the input multipartite graph. This path can be as long as wanted, with eventual cycles, and each string it contains should refer to a label in graph$parts.

initial_distribution

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

initial_node

(optional) A character string giving the label of a node in the first part 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 then 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 part, after having followed the input path within the different parts of the graph.

Examples

1
2
3
4
5
6
7
data (tripartite_example)
graph <- get_multipartite (data=tripartite_example)

path <- c(2,1,2,3)
as.matrix (get_distribution_from_path (graph, path))
as.matrix (get_distribution_from_path (graph, path, initial_distribution=c(1/3,0,0,2/3)))
as.matrix (get_distribution_from_path (graph, path, initial_node='i2'))

Lamarche-Perrin/triversity documentation built on May 22, 2019, 12:36 p.m.