DiagrammeR (version 0.9.0)

get_eccentricity: Get node eccentricities

Description

Get a named vector or data frame with node eccentricity values.

Usage

get_eccentricity(graph, nodes = NULL, return_type = "vector")

Arguments

graph

a graph object of class dgr_graph.

nodes

an optional vector of node IDs for filtering the list of nodes present in the graph.

return_type

using vector (the default) will provide a named vector of eccentricity values (the node IDs serve as names). With df, a data frame containing node IDs and eccentricity values is provided.

Value

a either a named vector or a data frame containing eccentricity values by node, depending on the value supplied to return_type.

Examples

Run this code
# NOT RUN {
# Get the eccentricities for all nodes in
# a randomly-created graph
get_eccentricity(
  graph = create_random_graph(
            15, 20, set_seed = 20))
#>  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15
#>  4  7  1  6  0  0  6  6  0  5  1  1  7  6  8
# }

Run the code above in your browser using DataCamp Workspace