row_normalised: Normalise a square matrix by dividing elements by the sum of...

Description Usage Arguments Value Examples

View source: R/utils.R

Description

Normalise a square matrix by dividing elements by the sum of off-diagonal entries row-wise. Note: sets diagonal to zero.

Usage

1
row_normalised(adj, keep_values = FALSE)

Arguments

adj

Adjacency matrix to normalise

keep_values

Whether to keep off-diagonal values or normalise fully (defaults to FALSE).

Value

A matrix based on adj with zero diagonals and off-diagonal elements sum to one.

Examples

1
2
3
d <- 5
adj <- matrix(1, d, d)
row_normalised(adj)

ntwk documentation built on Sept. 13, 2021, 9:07 a.m.