randTree {gRapHD}R Documentation

Random tree

Description

Generate a random tree.

Usage

  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 (Gabriel.Abreu@agrsci.dk)
Rodrigo Labouriau (Rodrigo.Labouriau@agrsci.dk)
David Edwards (David.Edwards@agrsci.dk)

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

  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

[Package gRapHD version 0.1.0 Index]