sparsify {backbone} | R 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,
normalize,
filter,
symmetrize = TRUE,
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 |
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 |
symmetrize |
boolean: TRUE if the result should be symmetrized |
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 |
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.
-
random
: a random number drawn from a uniform distribution -
betweenness
: edge betweenness -
triangles
: number of triangles that include the edge -
jaccard
: jaccard similarity coefficient of the neighborhoods of an edge's endpoints, or alternatively, triangles normalized by the size of the union of the endpoints neighborhoods -
dice
: dice similarity coefficient of the neighborhoods of an edge's endpoints -
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.
-
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.
-
threshold
: Edges with scores >=s
are retained in the backbone -
proportion
: Specifies the approximate proportion of edges to retain in the backbone -
degree
: Retains each node's d^s
most important edges, where d is the node's degree (requires thatnormalize = "rank"
) -
disparity
: Applies the disparity filter usingdisparity()
Using escore == "degree"
or normalize == "rank"
can yield an assymmetric network. When symmetrize == TRUE
(default),
after applying a filter, the network is symmetrized by such that i-j if i->j or i<-j.
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::sample_sbm(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