These functions allow properties and the topology of networks to be inspected
Usage
network_is_undirected(nw)
network_is_simple(nw)
network_is_weighted(nw)
network_is_temporal(nw)
network_size(nw)
network_outdegree(nw, nodes)
network_neighbour(nw, nodes, indices)
network_neighbour_weight(nw, nodes, indices)
network_adjacencylist(nw, above_diagonal = network_is_undirected(nw))
weighted_network_adjacencylist(nw, above_diagonal = network_is_undirected(nw))
network_bounds(nw)
network_coordinates(nw, nodes)
Value
network_is_simple(nw)
returns true if the network is simple, i.e. if it neither contains self-edges nor multi-edges. Note thatfalse
does not imply that the network necessarily contains self- or multi-edges, only that is is not guaranteed to be simple by construction.network_is_undirected(nw)
returns true if the network is not directed, i.e. if there is a link from node \(i\) to \(j\) exactly if there is a link from node \(j\) to \(i\). Note that similar tonetwork_is_simple
, a return value oftrue
guarantees that the network is undirected, butfalse
does not imply the existence of an edge without a reversed counterpart.network_is_weighted(nw)
return true if the network is weighted, i.e. if links have associated weightsnetwork_is_temporal(nw)
return true if the network is temporal, i.e. if links can appear and disappear during epidemic simulationsnetwork_size(nw)
returns the number of nodes in the networknetwork_outdegree(nw, node)
returns a vector of the same length asnodes
containing the out-degrees (i.e. number of outgoing links) of the nodes innodes
.network_neighbour(nw, nodes, indices)
returns a vector of the same length asnodes
andindices
containing the neighbours with the given index of the given nodes.network_neighbour_weight(nw, nodes, indices)
returns a named list containing vectors "n" and "w". "n" is a vector of the same length asnodes
andindices
and contains the neighbours with the given index of the given nodes. "w" is a vector of the same length and contains the corresponding weights.network_adjacencylist(nw, above_diagonal=network_is_undirected(nw))
returns a list of interger vectors where \(i\)-th vector contains the neighbours of node \(i\). For undirected networks, of the edge pair \((i,j)\) and \((j, i)\) only the edge \((i,j)\) with \(i \leq j\) is output, i.e. only the upper triangular submatrix of an symmetric adjacency matrix is considered. To include both edges, setabove_diagonal=FALSE
.weighted_network_adjacencylist(nw, above_diagonal=network_is_undirected(nw))
returns a list of named lists containing vectors "n" and "w". The vector "n" in the \(i\)-th list contains neighbours of node \(i\), and the vector "w" contains the corresponding weights. For undirected networks, of the edge pair \((i,j)\) and \((j, i)\) only the edge \((i,j)\) with \(i \leq j\) is output, i.e. only the upper triangular submatrix of an symmetric adjacency matrix is considered. To include both edges, setabove_diagonal=FALSE
.network_bounds(nw)
for networks embedded into \(d\)-dimensional space, this function returns a list containing two vectors of length \(d\), \(x\) and \(y\). \(x\) is a lower-bound and \(y\) the upper bound for the coordinates of the nodes in the network.network_coordinates(nw, nodes)
for networks embedded into \(d\)-dimensional space, this function returns a \(n\times d\) matrix containing the coordinates of the \(n\) nodes listed innodes
.