Skip to contents

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)

Arguments

nw

a network object

nodes

vector of node indices

indices

vector of neighbour indices

Value

  • network_is_simple(nw) returns true if the network is simple, i.e. if it neither contains self-edges nor multi-edges. Note that false 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 to network_is_simple, a return value of true guarantees that the network is undirected, but false 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 weights

  • network_is_temporal(nw) return true if the network is temporal, i.e. if links can appear and disappear during epidemic simulations

  • network_size(nw) returns the number of nodes in the network

  • network_outdegree(nw, node) returns a vector of the same length as nodes containing the out-degrees (i.e. number of outgoing links) of the nodes in nodes.

  • network_neighbour(nw, nodes, indices) returns a vector of the same length as nodes and indices 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 as nodes and indices 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, set above_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, set above_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 in nodes.

See also