randTree: Random tree

Description Usage Arguments Value Author(s) References Examples

View source: R/functions.r

Description

Generates a random tree

Usage

1
randTree(p,seed=1)

Arguments

p

number of vertices.

seed

seed (for the random generator, see set.seed).

Value

A list containing:

edges

matrix with 2 columns, each row representing one edge, and each column one of the vertices in the edge.

seed

seed.

p

number of vertices.

Author(s)

Gabriel Coelho Goncalves de Abreu (abreu_ga@yahoo.com.br)

References

Rodionov, A.S., Choo, H. On Generating Random Network Structures: Trees. Springer-Verlag Lecture Notes in Computer Science, vol. 2658, pp. 879-887, June 2003.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
tree <- randTree(p=10, seed=1)
plot(new("gRapHD",edges=tree$edges))
tree
# $edges
#       [,1] [,2]
#  [1,]    3    4
#  [2,]    3    5
#  [3,]    2    3
#  [4,]    4    6
#  [5,]    6    9
#  [6,]    1    6
#  [7,]    6   10
#  [8,]    6    7
#  [9,]    5    8
#
# $seed
# [1] 1
#
# $p
# [1] 10

gRapHD documentation built on Feb. 9, 2018, 6:05 a.m.

Related to randTree in gRapHD...