DiagrammeR (version 0.9.0)

get_degree_distribution: Get degree distribution data for a graph

Description

Get degree distribution data for a graph. Graph degree is represented as a frequency of degree values over all nodes in the graph.

Usage

get_degree_distribution(graph)

Arguments

graph

a graph object of class dgr_graph.

Value

a named vector of degree frequencies where the degree values serve as names.

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 distribution data for `random_graph`
graph %>% get_degree_distribution()
#> 0          1          2          3
#> 0.05555556 0.22222222 0.22222222 0.22222222
#> 4
#> 0.27777778
# }

Run the code above in your browser using DataLab