DiagrammeR (version 0.9.2)

get_degree_histogram: Get histogram data for a graph's degree frequency

Description

Get histogram data for a graph's degree frequency. The bin width is set to 1 and zero-value degrees are omitted from the output.

Usage

get_degree_histogram(graph, mode = "total")

Arguments

graph

a graph object of class dgr_graph.

mode

using total (the default), degree considered for each node will be the total degree. With in and out the degree used will be the in-degree and out-degree, respectively.

Value

a data frame with degree counts.

Examples

Run this code
# NOT RUN {
# Create a random, directed graph with 18 nodes
# and 22 edges
graph <-
  create_random_graph(
    n = 18, m = 22,
    set_seed = 23)

# Get degree histogram data for the
# `random_graph` (reporting on total degree)
graph %>%
  get_degree_histogram(mode = "total")
#>   degree total_degree_hist
#> 1      0                 1
#> 2      1                 4
#> 3      2                 4
#> 4      3                 4
#> 5      4                 5
# }

Run the code above in your browser using DataLab