pcFactorStan (version 0.11)

twoLevelGraph: Create an edge list with a random two level connectivity

Description

Initially, edges are added from the first vertex to all the other vertices. Thereafter, the first vertex is drawn from a Beta(shape1, 1.0) distribution and the second vertex is drawn from a Beta(shape2, 1.0) distribution. The idea is that the edges will tend to connect a small subset of vertices from the top of the tree to leaf vertices. These vertex connections are similar to the pairs that you might observe in an elimination tournament. The selected vertices are sorted so it doesn't matter whether shape1 > shape2 or shape1 < shape2 as long as shape1 != shape2.

Usage

twoLevelGraph(name, N, shape1 = 0.8, shape2 = 0.5)

Arguments

name

vector of vertex names

N

number of comparisons

shape1

beta distribution parameter for first edge

shape2

beta distribution parameter for second edge

Value

An undirected graph represented as a data frame with each row describing an edge.

See Also

Other graph generators: roundRobinGraph

Examples

Run this code
# NOT RUN {
twoLevelGraph(letters[1:5], 20)
# }

Run the code above in your browser using DataCamp Workspace