Get the bridging scores (based on Valente's Bridging vertex measure) for all nodes in a graph.
get_bridging(graph)
graph | a graph object of class
|
---|
a data frame with bridging scores for each of the nodes.
# Create a random graph using the # `add_gnm_graph()` function graph <- create_graph() %>% add_gnm_graph( n = 10, m = 12, set_seed = 23) # Get the bridging scores for nodes # in the graph graph %>% get_bridging()#> id bridging #> 1 1 0.018148148 #> 2 2 0.034953704 #> 3 3 0.008024691 #> 4 4 0.020814815 #> 5 5 0.018209877 #> 6 6 0.044444444 #> 7 7 0.046296296 #> 8 8 0.019537037 #> 9 9 0.044444444 #> 10 10 0.007870370# Add the bridging scores to # the graph as a node attribute graph <- graph %>% join_node_attrs( df = get_bridging(.)) # Display the graph's node data frame graph %>% get_node_df()#> id type label bridging #> 1 1 <NA> 1 0.018148148 #> 2 2 <NA> 2 0.034953704 #> 3 3 <NA> 3 0.008024691 #> 4 4 <NA> 4 0.020814815 #> 5 5 <NA> 5 0.018209877 #> 6 6 <NA> 6 0.044444444 #> 7 7 <NA> 7 0.046296296 #> 8 8 <NA> 8 0.019537037 #> 9 9 <NA> 9 0.044444444 #> 10 10 <NA> 10 0.007870370