add_pa_graph {DiagrammeR} | R Documentation |
To an existing graph object, add a graph built according to the Barabasi-Albert model, which uses preferential attachment in its stochastic algorithm.
add_pa_graph(graph, n, m = NULL, power = 1, out_dist = NULL, use_total_degree = FALSE, zero_appeal = 1, algo = "psumtree")
graph |
a graph object of class
|
n |
the number of nodes comprising the preferential attachment graph. |
m |
the number of edges to add in each time step. |
power |
the power of the preferential
attachment. The default value of |
out_dist |
a numeric vector that provides the distribution of the number of edges to add in each time step. |
use_total_degree |
a logical value (default is
|
zero_appeal |
a measure of the attractiveness of the nodes with no adjacent edges. |
algo |
the algorithm to use to generate the
graph. The available options are |
# Create an undirected PA # graph with 100 nodes, adding # 2 edges at every time step pa_graph <- create_graph( directed = FALSE) %>% add_pa_graph( n = 100, m = 1) # Get a count of nodes pa_graph %>% node_count() #> [1] 100 # Get a count of edges pa_graph %>% edge_count() #> [1] 99