Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

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

# Create a random graph using the
# `add_gnm_graph()` function
graph <-
  create_graph(
    directed = FALSE) %>%
  add_gnm_graph(
    n = 10,
    m = 15,
    set_seed = 23)

# Get degree histogram data for
# the graph (reporting total degree)
graph %>%
  get_degree_histogram(
    mode = "total")

DiagrammeR

Graph/Network Visualization

v1.0.6.1
MIT + file LICENSE
Authors
Richard Iannone [aut, cre] (<https://orcid.org/0000-0003-3925-190X>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.