1% Generated by roxygen2: do not edit by hand
2% Please edit documentation in R/get_agg_degree_total.R
3\name{get_agg_degree_total}
4\alias{get_agg_degree_total}
5\title{Get an aggregate value from the total degree of nodes}
6\usage{
7get_agg_degree_total(graph, agg, conditions = NULL)
8}
9\arguments{
10\item{graph}{A graph object of class \code{dgr_graph}.}
11
12\item{agg}{the aggregation function to use for summarizing total degree
13values from graph nodes. The following aggregation functions can be used:
14\code{sum}, \code{min}, \code{max}, \code{mean}, or \code{median}.}
15
16\item{conditions}{an option to use filtering conditions for the nodes to
17consider.}
18}
19\value{
20A vector with an aggregate total degree value.
21}
22\description{
23Get a single, aggregate value from the total degree values for all nodes in a
24graph, or, a subset of graph nodes.
25}
26\examples{
27# Create a random graph using the
28# `add_gnm_graph()` function
29graph <-
30  create_graph() \%>\%
31  add_gnm_graph(
32    n = 20,
33    m = 35,
34    set_seed = 23) \%>\%
35  set_node_attrs(
36    node_attr = value,
37    values = rnorm(
38      n = count_nodes(.),
39      mean = 5,
40      sd = 1) \%>\% round(1))
41
42# Get the mean total degree
43# value from all nodes in
44# the graph
45graph \%>\%
46  get_agg_degree_total(
47    agg = "mean")
48
49# Other aggregation functions
50# can be used (`min`, `max`,
51# `median`, `sum`); let's get
52# the median in this example
53graph \%>\%
54  get_agg_degree_total(
55    agg = "median")
56
57# The aggregation of total
58# degree can occur for a
59# subset of the graph nodes
60# and this is made possible
61# by specifying `conditions`
62# for the nodes
63graph \%>\%
64  get_agg_degree_total(
65    agg = "mean",
66    conditions = value < 5.0)
67
68}
69