1% Generated by roxygen2: do not edit by hand 2% Please edit documentation in R/add_pa_graph.R 3\name{add_pa_graph} 4\alias{add_pa_graph} 5\title{Add a preferential attachment graph} 6\usage{ 7add_pa_graph( 8 graph, 9 n, 10 m = NULL, 11 power = 1, 12 out_dist = NULL, 13 use_total_degree = FALSE, 14 zero_appeal = 1, 15 algo = "psumtree", 16 type = NULL, 17 label = TRUE, 18 rel = NULL, 19 node_aes = NULL, 20 edge_aes = NULL, 21 node_data = NULL, 22 edge_data = NULL, 23 set_seed = NULL 24) 25} 26\arguments{ 27\item{graph}{A graph object of class \code{dgr_graph}.} 28 29\item{n}{The number of nodes comprising the preferential attachment graph.} 30 31\item{m}{The number of edges to add in each time step.} 32 33\item{power}{The power of the preferential attachment. The default value of 34\code{1} indicates a linear preferential attachment.} 35 36\item{out_dist}{A numeric vector that provides the distribution of the number 37of edges to add in each time step.} 38 39\item{use_total_degree}{A logical value (default is \code{TRUE}) that governs 40whether the total degree should be used for calculating the citation 41probability. If \code{FALSE}, the indegree is used.} 42 43\item{zero_appeal}{A measure of the attractiveness of the nodes with no 44adjacent edges.} 45 46\item{algo}{The algorithm to use to generate the graph. The available options 47are \code{psumtree}, \code{psumtree-multiple}, and \code{bag}. With the \code{psumtree} 48algorithm, a partial prefix-sum tree is used to to create the graph. Any 49values for \code{power} and \code{zero_appeal} can be provided and this algorithm 50never generates multiple edges. The \code{psumtree-multiple} algorithm also uses 51a partial prefix-sum tree but the difference here is that multiple edges 52are allowed. The \code{bag} algorithm places the node IDs into a bag as many 53times as their in-degree (plus once more). The required number of cited 54nodes are drawn from the bag with replacement. Multiple edges may be 55produced using this method (it is not disallowed).} 56 57\item{type}{An optional string that describes the entity type for all the 58nodes to be added.} 59 60\item{label}{A logical value where setting to \code{TRUE} ascribes node IDs to the 61label and \code{FALSE} yields a blank label.} 62 63\item{rel}{An optional string for providing a relationship label to all edges 64to be added.} 65 66\item{node_aes}{An optional list of named vectors comprising node aesthetic 67attributes. The helper function \code{\link[=node_aes]{node_aes()}} is strongly recommended for 68use here as it contains arguments for each of the accepted node aesthetic 69attributes (e.g., \code{shape}, \code{style}, \code{color}, \code{fillcolor}).} 70 71\item{edge_aes}{An optional list of named vectors comprising edge aesthetic 72attributes. The helper function \code{\link[=edge_aes]{edge_aes()}} is strongly recommended for 73use here as it contains arguments for each of the accepted edge aesthetic 74attributes (e.g., \code{shape}, \code{style}, \code{penwidth}, \code{color}).} 75 76\item{node_data}{An optional list of named vectors comprising node data 77attributes. The helper function \code{\link[=node_data]{node_data()}} is strongly recommended for 78use here as it helps bind data specifically to the created nodes.} 79 80\item{edge_data}{An optional list of named vectors comprising edge data 81attributes. The helper function \code{\link[=edge_data]{edge_data()}} is strongly recommended for 82use here as it helps bind data specifically to the created edges.} 83 84\item{set_seed}{Supplying a value sets a random seed of the 85\code{Mersenne-Twister} implementation.} 86} 87\description{ 88To an existing graph object, add a graph built according to the 89Barabasi-Albert model, which uses preferential attachment in its stochastic 90algorithm. 91} 92\examples{ 93# Create an undirected PA 94# graph with 100 nodes, adding 95# 2 edges at every time step 96pa_graph <- 97 create_graph( 98 directed = FALSE) \%>\% 99 add_pa_graph( 100 n = 100, 101 m = 1) 102 103# Get a count of nodes 104pa_graph \%>\% count_nodes() 105 106# Get a count of edges 107pa_graph \%>\% count_edges() 108 109} 110