Learn R Programming

qgraph (version 1.10.1)

smallworldness: Compute the small-worldness index.

Description

Compute the small-worldness index (Humphries & Gurney, 2008) relying on the global transitivity of the network (Newman, 2003) and on its average shortest path length.

Usage

smallworldness(x, B = 1000, up = 0.995, lo = 0.005,
               unconnected = c("infinite", "N", "exclude"))

Value

smallworldness

the "small-worldness" index proposed by Humphries & Gurney (2008)

trans_target

the global transitivity of the target network (Newman, 2003)

averagelength_target

the average shortest path length in the target network

trans_rnd_M

the average transitivity in the B random networks

trans_rnd_lo

the lo quantile of the transitivity in the B random networks

trans_rnd_up

the up quantile of the transitivity in the B random networks

averagelength_rnd_M

the average shortest path length in the B random networks

averagelength_rnd_lo

the lo quantile of the shortest path length in the B random networks

averagelength_rnd_up

the up quantile of the shortest path length in the B random networks

Arguments

x

A graph. Can be a qgraph object, an igraph object, an adjacency matrix, a weight matrix, an edgelist, or a weighted edgelist.

B

The number of random networks.

up

The upper quantile.

lo

The lower quantile.

unconnected

How the infinite distance between unconnected pairs of nodes enters the average shortest path length. "infinite" (the default): infinite distances propagate, so any disconnected network (including disconnected random reference networks) has an infinite average path length and the small-worldness index is NaN, Inf or 0 (with a warning). "N": unconnected pairs are counted as path length N, the number of nodes, i.e., one more than the maximum possible (unweighted) path length. "exclude": unconnected pairs are excluded, so the average is computed over connected pairs only. The latter two options should be a conscious choice.

Author

Giulio Costantini (giulio.costantini@unimib.it), Sacha Epskamp (mail@sachaepskamp.com)

Details

The function computes the transitivity of the target network and the average shortest path length. Then it computes the average of the same indices on B random networks. The small-worldness index is then computed as the transitivity (normalized by the random transitivity) over the average shortest path length (normalized by the random average shortest path length). The lo and up quantiles of the distribution of the random networks are also returned for both the transitivity and the average shortest path length.

The random networks share the degree sequence of the target network and are sampled with sample_degseq (method "fast.heur.simple", the renamed equivalent of the method used in earlier versions, so that results are backward compatible). Note that this method does not sample exactly uniformly from the graphs with the given degree sequence.

The distance between unconnected pairs of nodes is infinite; the unconnected argument controls how such pairs enter the average shortest path length (see above). By default, infinite distances propagate, so that disconnected networks yield an undefined small-worldness index unless a different treatment is chosen explicitly.

A network can be said "smallworld" if its smallworldness is higher than one (a stricter rule is smallworldness>=3; Humphries & Gurney, 2008). To consider a network as "smallworld", it is also suggested to inspect that the network has a transitivity substantially higher than comparable random networks and that its average shortest path length is similar to, or higher than (but not many times higher than), that computed on random networks. Edge weights, signs and directions are ignored in the computation of the indices.

References

Costantini, G., Epskamp, S., Borsboom, D., Perugini, M., Mottus, R., Waldorp, L., Cramer, A. O. J., State of the aRt personality research: A tutorial on network analysis of personality data in R. Manuscript submitted for publication.

Humphries, M. D., & Gurney, K. (2008). Network "small-world-ness": a quantitative method for determining canonical network equivalence. PLoS One, 3(4), e0002051.

Newman, M. E. J. (2003). The structure and function of complex networks*. SIAM Review, 45(3), 167–256.

Examples

Run this code
set.seed(1)
# a regular lattice. Even if the small-worldness is higher than three, the average path length is 
# much higher than that of random networks.
regnet<-igraph::sample_smallworld(dim=1, size=1000, nei=10, p=0, loops=FALSE, multiple=FALSE)
smallworldness(regnet, B=10)

if (FALSE) {
# a small-world network: the transitivity is much higher than random, the average path length is 
# close to that of random networks
swnet<-igraph::sample_smallworld(dim=1, size=1000, nei=10, p=.1, loops=FALSE, multiple=FALSE)
smallworldness(swnet, B=10)

# a pseudorandom network: both the average path length and the transitivity are similar to random 
# networks.
rndnet<-igraph::sample_smallworld(dim=1, size=1000, nei=10, p=1, loops=FALSE, multiple=FALSE)
smallworldness(rndnet, B=10)
}

Run the code above in your browser using DataLab