Last data update: 2014.03.03

R: A function to generate simulated networks from the...
GenerateNetR Documentation

A function to generate simulated networks from the Barabasi-Albert model or the fitness model

Description

This function generates networks from the Barabasi-Albert model or the fitness model. The number of edges of the new node at each time-step can be specified to be fixed, or followed a Poisson distribution. In the latter case, the mean of the Poisson distribution is either held fixed or increased with time.

Usage

GenerateNet(N        = 1000, m      = 1    , mode     = c(1,2,3), alpha = 1, beta = 1, 
            sat_at   = 100 , offset = 1    , rate     = 0       , shape = 0,
            num_seed = 2   , prob_m = FALSE, increase = FALSE   , log   = FALSE)

Arguments

N

Integer. Total number of nodes in the network (including the nodes in the seed graph). Default value is 1000.

m

Integer. The number of edges of the new node. Default value is 1.

mode

Integer. Indicates the attachment function to be used in generating the network. If mode == 1, the attachment function is A_k = k^α. If mode == 2, the attachment function is A_k = min(k,sat_at)^α. If mode == 3, the attachment function is A_k = α log (k)^β. Default value is 1.

alpha

Numeric. If mode == 1, this is the attachment exponent in the attachment function A_k = k^α. If mode == 2, this is the attachment exponenet in the attachment function A_k = min(k,sat_at)^α. If mode == 3, this is the alpha in the attachment function A_k = α log (k)^β + 1.

beta

Numeric. This is the beta in the attachment function A_k = α log (k)^β + 1.

sat_at

Integer. This is the saturation position sat_at in the attachment function A_k = min(k,sat_at)^α.

offset

Numeric. The attachment value of degree 0. Default value is 1.

rate

Numeric. The rate parameter in the Gamma prior for node fitness. If either rate or shape is 0, node fitness f is fixed at 1 (i.e. Barabasi-Albert model)

shape

Numeric. The shape parameter in the Gamma prior for node fitness. If either rate or shape is 0, node fitness f is fixed at 1 (i.e. Barabasi-Albert model)

num_seed

Integer. The number of nodes of the seed graph (the initial state of the network). Default value is 2.

prob_m

Logical. Indicates whether we fix the number of edges of a new node as a constant, or let it follows a Poisson distribution. If prob_m == TRUE, the number of edges of a new node follows a Poisson distribution. The mean of this distribution depends on the value of increase and log. Default value is FALSE.

increase

Logical. Indicates whether we increase the mean of the Poisson distribution over time. If increase == FALSE, the mean is fixed at m. If increase == TRUE, the way the mean increases depends on the value of log. Default value is FALSE.

log

Logical. Indicates how to increase the mean of the Poisson distribution. If log == TRUE, the mean increases logarithmically with the number of current nodes. If log == FALSE, the mean increases linearly with the number of current nodes. Default value is FALSE.

Value

The output is a List contains the following two fields:

graph

a 3-column matrix, where each row contains information of one edge, in the form of (from_id, to_id, time_stamp). From_id is the id of the source, to_id is the id of the destination.

fitness

fitness values of nodes in the network

Author(s)

Thong Pham thongpham@thongpham.net

References

1. Pham, T. and Sheridan, P. and Shimodaira, H. (2015). Nonparametric estimation of the preferential attachment function in complex networks: evidence of deviations from log linearity, in press. Proceedings of ECCS 2014: European Conference on Complex Systems.

2. Pham T, Sheridan P, Shimodaira H (2015) PAFit: A Statistical Method for Measuring Preferential Attachment in Temporal Complex Networks. PLoS ONE 10(9): e0137796. doi:10.1371/journal.pone.0137796 (http://dx.doi.org/10.1371/journal.pone.0137796)

Examples

library("PAFit")
#Generate a network from the original BA model with alpha = 1, N = 100, m = 1
data   <- GenerateNet(N = 100,m = 1,mode = 1, alpha = 1, shape = 0, rate = 0)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(PAFit)
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/PAFit/GenerateNet.Rd_%03d_medium.png", width=480, height=480)
> ### Name: GenerateNet
> ### Title: A function to generate simulated networks from the
> ###   Barabasi-Albert model or the fitness model
> ### Aliases: GenerateNet
> ### Keywords: scale free BA network preferential attachment
> ###   Bianconi-Barabasi model fitness model
> 
> ### ** Examples
> 
> library("PAFit")
> #Generate a network from the original BA model with alpha = 1, N = 100, m = 1
> data   <- GenerateNet(N = 100,m = 1,mode = 1, alpha = 1, shape = 0, rate = 0)
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>