Sparsify.matrix.fixed.neighbours-methods {NetPreProc} | R Documentation |
Sparsifying the graph by a fixed number of edges per node
Description
Methods to sparsify a network matrix by fixing the number of edges for each node. It selects the first k neighbours for each node (by row) according to the weight of the edge By this function you select exactly k edges for each node (if there are at least k edges in the adjacency matrix). The resulting matrix is not symmetric.
Usage
Sparsify.matrix.fixed.neighbours(W, k=10)
Arguments
W |
an object representing the graph to be normalized |
k |
the number of edges for each node (def.=10) |
Value
a sparsified matrix (Warning: the matrix is not symmetric)
Methods
signature(W = "graph")
-
an object of the virtual class graph (hence including objects of class
graphAM
andgraphNEL
from the package graph) signature(W = "matrix")
-
a matrix representing the adjacency matrix of the graph
Examples
library(bionetdata);
data(FIN.data);
W <- Laplacian.norm(as.matrix(FIN.data));
# sparsification with 10 neighbours per node
W10 <- Sparsify.matrix.fixed.neighbours(W);
# sparsification with 20 neighbours per node
W20 <- Sparsify.matrix.fixed.neighbours(W, k=20);
[Package NetPreProc version 1.2 Index]