diff --git a/R/hrg.R b/R/hrg.R index 3a3fbfb5a9f..81dcd6dd3f8 100644 --- a/R/hrg.R +++ b/R/hrg.R @@ -303,6 +303,14 @@ fit_hrg <- function(graph, hrg = NULL, start = FALSE, steps = 0) { #' } #' } #' @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 #' @cdocs igraph_hrg_consensus consensus_tree <- function( diff --git a/man/consensus_tree.Rd b/man/consensus_tree.Rd index 7025d691b63..b6473b2e3ab 100644 --- a/man/consensus_tree.Rd +++ b/man/consensus_tree.Rd @@ -46,6 +46,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}()},