node_sparsity: Percentage of inactive nodes in a network

View source: R/extra_functions.R

node_sparsityR Documentation

Percentage of inactive nodes in a network

Description

Calculates the node sparsity of a vectorized adjacency matrix, defined as the average number of nodes with no edges.

Usage

node_sparsity(beta, type = c("undirected", "directed"))

Arguments

beta

Vectorized adjacency matrix.

type

Specifies whether the vector represents an undirected or directed network. Default is undirected.

Value

Percentage of inactive nodes in the graph

Examples

A <- matrix(0, ncol = 4, nrow = 4)
A[2, 1] <- 1
A[1, 2] <- 1
A[2, 3] <- 1
A[3, 2] <- 1
vec <- matrix_to_vec(A)
node_sparsity(vec)


jesusdaniel/graphclass documentation built on Aug. 10, 2022, 3:10 p.m.