Learn R Programming

crosstalkr (version 1.0.4)

norm_colsum: Function to normalize adjacency matrix by dividing each value by the colsum.

Description

Function to normalize adjacency matrix by dividing each value by the colsum.

Usage

norm_colsum(w)

Value

input matrix, normalized by column sums

Arguments

w

The adjacency matrix of a given graph in sparse format - dgCMatrix

Examples

Run this code
# 1) Normalize by column sum on a simple matrix
v1 = (c(1,1,1,0))
v2 = c(0,0,0,1)
v3 = c(1,1,1,0)
v4 = c(0,0,0,1)
w = matrix(data = c(v1,v2,v3,v4), ncol = 4, nrow = 4)
norm_colsum(w)

Run the code above in your browser using DataLab