global {backbone} | R Documentation |
global
extracts the backbone of a weighted network using a global threshold
global(
W,
upper = 0,
lower = NULL,
keepzeros = TRUE,
class = "original",
narrative = FALSE
)
W |
A weighted unipartite graph, as: (1) an adjacency matrix in the form of a matrix or sparse |
upper |
real, FUN, or NULL: upper threshold value or function that evaluates to an upper threshold value. |
lower |
real, FUN, or NULL: lower threshold value or function that evaluates to a lower threshold value. |
keepzeros |
boolean: TRUE if zero-weight edges in |
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. |
The global
function retains a edge in the backbone if its weight exceeds upper
. If a lower
threshold is also
specified, it returns a signed backbone in which edge weights are set to 1 if above the given upper threshold,
set to -1 if below the given lower threshold, and set to 0 otherwise.
If W
is an unweighted bipartite graph, any rows and columns that contain only zeros or only ones are removed, then
the global threshold is applied to its weighted bipartite projection.
Binary or signed backbone graph of class given in parameter class
.
package: Neal, Z. P. (2022). backbone: An R Package to Extract Network Backbones. PLOS ONE, 17, e0269137. doi: 10.1371/journal.pone.0269137
model: Neal, Z. P. (2014). The backbone of bipartite projections: Inferring relationships from co-authorship, co-sponsorship, co-attendance, and other co-behaviors. Social Networks, 39, 84-97. doi: 10.1016/j.socnet.2014.06.001
W <- matrix(sample(0:5, 100, replace = TRUE), 10) #Random weighted graph
diag(W) <- 0
W
global(W, narrative = TRUE) #Keep all non-zero edges
global(W, upper = 4, lower = 2, narrative = TRUE) #Signed with specified thresholds
global(W, upper = function(x)mean(x), #Above-average --> positive edges
lower = function(x)mean(x), narrative = TRUE) #Below-average --> negative edges