Creates a weighted network for an adjacency list stored in a file
Source:R/network.R
empirical_weightednetwork.Rd
The file must contain one line per node listing first a node and then
pairs of neighbours and their weights. Pairs are separated by whitespace,
neighbours and weights by a colon (':'); other separators can be specifed.
Nodes are identified by numbers starting with idxbase
(by default 1);
the maximal node index that appears in the file defines the size of the
network. For undirected networks (i.e. if undirected=TRUE
), for every
link (u,v) listed in the file the reverse link (v,u) is added as well.
Lines starting with the comment chracter '#' and skipped. If the first non-comment line does not start with a numerical node index, it is assumed to be a header line and skipped as well.
Usage
empirical_weightednetwork(
path,
undirected = TRUE,
simplify = FALSE,
idxbase = 1,
csep = " ",
wsep = ":",
gzip = grepl("\\.gz$", path)
)
Arguments
- path
name of the file
- undirected
if
TRUE
the network is assumed to be undirected- simplify
whether to remove self-edges and multi-edges
- idxbase
index of the first node (typically 1 or 0, default 1)
- csep
separator between neighbours/weight pairs, by default whitespace
- wsep
separator between neighbour and its weight, by default ':'
- gzip
whether the file is compressed