sparsify: Extract the backbone from a network using a sparsification...

View source: R/sparsify.R

sparsifyR Documentation

Extract the backbone from a network using a sparsification model

Description

A generic function to extract the backbone of an undirected, unipartite network using a sparsification model described by a combination of an edge scoring metric, a edge score normalization, and an edge score filter.

Usage

sparsify(
  U,
  s,
  escore = "original",
  normalize,
  filter,
  umst = FALSE,
  class = "original",
  narrative = FALSE
)

Arguments

U

An unweighted unipartite graph, as: (1) an adjacency matrix in the form of a matrix or sparse Matrix; (2) an edgelist in the form of a two-column dataframe; (3) an igraph object.

s

numeric: Sparsification parameter

escore

string: Method for scoring edges' importance

normalize

string: Method for normalizing edge scores

filter

string: Type of filter to apply

umst

boolean: TRUE if the backbone should include the union of minimum spanning trees, to ensure connectivity

class

string: the class of the returned backbone graph, one of c("original", "matrix", "Matrix", "igraph", "edgelist"). If "original", the backbone graph returned is of the same class as U.

narrative

boolean: TRUE if suggested text & citations should be displayed.

Details

The escore parameter determines how an unweighted edge's importance is calculated. Unless noted below, scores are symmetric and larger values represent more important edges. There are 10 options for assigning an edge's score; when escore =

  • random: a random number drawn from a uniform distribution

  • betweenness: edge betweenness

  • triangles: number of triangles that include the edge

  • jaccard: jaccard coefficient of the neighborhoods of an edge's endpoints, or alternatively, triangles normalized by the size of the union of the endpoints neighborhoods

  • quadrangles: number of quadrangles that include the edge

  • quadrilateral embeddedness: geometric mean normalization of quadrangles

  • degree: degree of neighbor to which an edge is adjacent (asymmetric)

  • meetmin: triangles normalized by the smaller of the endpoints' neighborhoods' sizes

  • geometric: triangles normalized by the product of the endpoints' neighborhoods' sizes

  • hypergeometric: probability of the edge being included at least as many triangles if edges were random, given the size of the endpoints' neighborhoods (smaller is more important)

The normalize parameter determines whether edge scores are normalized. There are three options; when normalize =

  • none: no normalization is performed

  • rank: scores are normalized by neighborhood rank, such that the strongest edge in a node's neighborhood is ranked 1 (asymmetric)

  • embeddedness: scores are normalized using the maximum Jaccard coefficient of the top k-ranked neighbors of each endpoint, for all k

The filter parameter determines how edges are filtered based on their (normalized) edge scores. There are three options; when filter =

  • threshold: Edges with scores more important than s are retained in the backbone

  • proportion: Specifies the proportion of most important edges to retain in the backbone

  • degree: Retains each node's d^s most important edges, where d is the node's degree (requires that normalize = "rank")

Specific combinations of escore, normalize, filter, and umst correspond to specific sparsification models in the literature, and are available via the following wrapper functions: sparsify.with.skeleton(), sparsify.with.gspar(), sparsify.with.lspar(), sparsify.with.simmelian(), sparsify.with.jaccard(), sparsify.with.meetmin(), sparsify.with.geometric(), sparsify.with.hypergeometric(), sparsify.with.localdegree(), sparsify.with.quadrilateral(). See the documentation for these wrapper functions for more details and the associated citation.

Value

An unweighted, undirected, unipartite graph of class class.

References

Neal, Z. P. (2022). backbone: An R Package to Extract Network Backbones. PLOS ONE, 17, e0269137. doi: 10.1371/journal.pone.0269137

Examples

U <- igraph::sbm.game(60, matrix(c(.75,.25,.25,.25,.75,.25,.25,.25,.75),3,3), c(20,20,20))
plot(U) #A hairball
sparse <- sparsify(U, s = 0.6, escore = "jaccard", normalize = "rank",
filter = "degree", narrative = TRUE)
plot(sparse) #Clearly visible communities

backbone documentation built on Oct. 19, 2022, 1:09 a.m.