RM_erdos: Generate a random stochastic matrix for a walk on an...

Description Usage Arguments Value Examples

View source: R/matrices.R

Description

An Erdos-Renyi Graph is a graph whose edges are connected ~ Bern(p). Hence, its transition matrix will have nonzero entries with that probability. So, we can alternatively think of the transition matrix for such walk as a stochastic matrix with parameterized sparsity.

Usage

1
RM_erdos(N, p)

Arguments

N

number of dimensions of the square matrix

p

the probability two vertices are connected in an Erdos-Renyi graph.

Value

A random stochastic matrix corrosponding to a walk on an Erdos-Renyi graph with probability p.

Examples

1
2
3
4
5
6
7
8
# Very sparse graph
P <- RM_erdos(N = 3, p = 0.2)

# Slightly sparse graph
P <- RM_erdos(N = 9, p = 0.6)

# Completely connected graph
P <- RM_erdos(N = 5, p = 1)

RMAT documentation built on April 28, 2021, 9:06 a.m.