RootedTreeShape(PectinateTree(8))
plot(RootedTreeWithShape(0, nTip = 8L))
NRootedShapes(8L)
# Shapes are numbered from 0 to NRootedShapes(n) - 1. The maximum shape is:
RootedTreeShape(BalancedTree(8))
# Unique shapes of unrooted trees:
NUnrootedShapes(8L)
# Keys of these trees:
UnrootedKeys(8L)
# A tree may be represented by multiple keys.
# For a one-to-one correspondence, use a number instead:
unrootedShapes8 <- as.integer(NUnrootedShapes(8L))
allShapes <- lapply(seq_len(unrootedShapes8) - 1L,
UnrootedTreeWithShape, 8L)
plot(allShapes[[1]])
sapply(allShapes, UnrootedTreeShape)
sapply(allShapes, UnrootedTreeKey, asInteger = TRUE) # Key >= number
# If numbers larger than 2>31 are required, sapply needs a little help
# with 64-bit integers:
structure(sapply(allShapes, UnrootedTreeKey), class = "integer64")
Run the code above in your browser using DataLab