Learn R Programming

PAFit (version 1.2.10)

as.PAFit_net: Converting an edgelist matrix to a PAFit_net object

Description

This function converts a graph stored in an edgelist matrix format to a PAFit_net object.

Usage

as.PAFit_net(graph, type = "directed", PA = NULL, fitness = NULL)

Value

An object of class PAFit_net

Arguments

graph

An edgelist matrix. Each row is assumed to be of the form (from_node_id to_node_id time_stamp). For a directed network ,from_node_id is the id of the source node and to_node_id is the id of the destination node. For an undirected network, the order is ignored and from_node_id and to_node_id are the ids of two ends. time_stamp is the arrival time of the edge. from_node_id and to_node_id are assumed to be integers that are at least \(0\). The whole ids need not to be contiguous.

To register a new node \(i\) at time \(t\) without any edge, add a row with format (i -1 t). This works for both undirected and directed networks.

time_stamp can be either numeric or string. The value of a time-stamp can be arbitrary, but we assume that a smaller time_stamp (regarded so by the sort function in R) represents an earlier arrival time. Examples of time-stamps that satisfy this assumption are the integer 0:T, the string format `yyyy-mm-dd', and the POSIX time.

type

String. Indicates whether the network is "directed" or "undirected".

PA

Numeric vector. Contains the PA function. Default value is NULL.

fitness

Numeric vector. Contains node fitnesses. Default value is NULL.

Author

Thong Pham thongphamthe@gmail.com

Examples

Run this code
library("PAFit")
# a network from Bianconi-Barabasi model
net        <- generate_BB(N = 50 , m = 10 , s = 10)
as.PAFit_net(net$graph)

Run the code above in your browser using DataLab