Binary.matrix.by.thresh-methods: Transforming a real-valued network matrix into a binary...

Binary.matrix.by.thresh-methodsR Documentation

Transforming a real-valued network matrix into a binary matrix

Description

Methods to transform a a real-valued network matrix into a binary matrix. The binary matrix is obtained by thresholding: values above the given threshold are set to 1, otherwise to 0

Usage

Binary.matrix.by.thresh(W, thresh=0.5)

Arguments

W

an object representing the graph to be normalized

thresh

the threshold (def.=0.5)

Value

The normalized binary adjacency matrix of the network

Methods

signature(W = "graph")

an object of the virtual class graph (hence including objects of class graphAM and graphNEL from the package graph)

signature(W = "matrix")

a matrix representing the adjacency matrix of the graph

Examples

library(bionetdata);
data(DD.chem.data);
W <- Binary.matrix.by.thresh(DD.chem.data);

# Using both methods with both signatures "matrix" and "graph"
# reducing dimension of the graph
library(graph);
DD.chem.data.red <- DD.chem.data[1:100,1:100];
W.red <- Binary.matrix.by.thresh(DD.chem.data.red);
g <- new("graphAM", adjMat=DD.chem.data.red, values=list(weight=DD.chem.data.red));
Wg <- Binary.matrix.by.thresh(g);
any(W.red!=Wg);

NetPreProc documentation built on Sept. 19, 2022, 5:06 p.m.