randTree {gRapHD} | R Documentation |
Generate a random tree.
randTree(p,seed=1)
p |
number of vertices. |
seed |
seed (for the random generator, see
set.seed ). |
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. |
Gabriel Coelho Goncalves de Abreu (Gabriel.Abreu@agrsci.dk)
Rodrigo Labouriau (Rodrigo.Labouriau@agrsci.dk)
David Edwards (David.Edwards@agrsci.dk)
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.
tree <- randTree(p=10, seed=1) plotG(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