Learn R Programming

simplifyNet (version 0.0.1)

gns: Global Network Sparsification

Description

Remove all edges under certain edge weight threshold.

Usage

gns(network, remove.prop, cutoff, directed = FALSE)

Value

Edge list of sparsified network

Arguments

network

Weighted adjacency matrix, weighted igraph network, or edge list formatted | n1 | n2 | weight | with colnames c("n1", "n2", "weight").

remove.prop

The proportion of highest weighted edges to retain. A value between 0 and 1.

cutoff

Threshold value for edge weight thresholding.

directed

If TRUE, specifies that the inputted network is directed. Default is FALSE.

Author

Andrew Kramer

Alexander Mercier

Examples

Run this code
#Generate random ER graph with uniformly random edge weights
g = igraph::erdos.renyi.game(100, 0.1)
igraph::E(g)$weight <- runif(length(igraph::E(g)))
#Sparsify g via GNS
S = gns(g, remove.prop = 0.5)
sg = simplifyNet::net.as(S, net.to="igraph", directed=FALSE)
igraph::ecount(sg)/igraph::ecount(g)#fraction of edges in the sparsifier

Run the code above in your browser using DataLab