normalize_A: Normalize an affinity matrix

Description Usage Arguments Details Value References Examples

Description

This function provides different modes of normalizing an affinity matrix.

Usage

1
normalize_A(A, M_type)

Arguments

A

a symmetric affinity matrix. Can be dense or sparse from package Matrix.

M_type

a character string with one of "asym", "sym", or "as_is" (see details).

Details

All methods for normalization start by removing possible diagonal elements. The available methods are:

asym

asymmetric normalization, which yields a singly stochastic matrix, where rows add to 1.

sym

symmetric normalization, yielding a symmetric matrix.

rm_diag

only removes possible diagonal elements.

Value

A sparse normalized affinity matrix.

References

Mostafavi, S., Goldenberg, A., & Morris, Q. (2012). Labeling nodes using three degrees of propagation. PloS one, 7(12), e51947.

Examples

1
2
3
# simulate_simple_SBM does not produce self connections
A = as.matrix(simulate_simple_SBM(25L, 0.2, 0.001, 0.25)$A)
all.equal(normalize_A(A, "rm_diag"), A)

miguelbiron/threepRop documentation built on May 29, 2019, 9:31 a.m.