+ if (force.positive) {
+ o <- .Call("seq_root2tip", phy$edge, n, m, PACKAGE = "ape")
+ list.nodes <- list(n + 1L)
+ i <- 2L
+ repeat {
+ z <- sapply(o, "[", i)
+ z <- unique(z[!(z <= n | is.na(z))])
+ if (!length(z)) break
+ list.nodes[[i]] <- z
+ i <- i + 1L
+ }
+ nodes <- unlist(lapply(list.nodes, function(x) x[sample(length(x))]))
+ y[nodes] <- sort(x, decreasing = TRUE)
+ }