diff --git a/R/hrg.R b/R/hrg.R index 76f844dfb8..87626cfd94 100644 --- a/R/hrg.R +++ b/R/hrg.R @@ -253,6 +253,14 @@ fit_hrg <- function(graph, hrg = NULL, start = FALSE, steps = 0) { #' split occurred in the generated network samples, for each internal #' vertices. The order is the same as in the `parents` vector.} #' @family hierarchical random graph functions +#' @examples +#' ## A graph with two dense groups +#' g <- sample_gnp(10, p = 1 / 2) + sample_gnp(10, p = 1 / 2) +#' hrg <- fit_hrg(g) +#' hrg +#' +#' ## The consensus tree for it +#' consensus_tree(g, hrg = hrg, start = TRUE) #' @export consensus_tree <- hrg_consensus_impl diff --git a/man/consensus_tree.Rd b/man/consensus_tree.Rd index dff3b677f1..7368e71603 100644 --- a/man/consensus_tree.Rd +++ b/man/consensus_tree.Rd @@ -40,6 +40,15 @@ argument is given and \code{start} is set to \code{TRUE}, then it starts sampling from the given HRG. Otherwise it optimizes the HRG log-likelihood first, and then samples starting from the optimum. } +\examples{ +## A graph with two dense groups +g <- sample_gnp(10, p = 1 / 2) + sample_gnp(10, p = 1 / 2) +hrg <- fit_hrg(g) +hrg + +## The consensus tree for it +consensus_tree(g, hrg = hrg, start = TRUE) +} \seealso{ Other hierarchical random graph functions: \code{\link{fit_hrg}()},