nd_centrality: Centrality Distance

Description Usage Arguments Value References Examples

Description

Centrality is a core concept in studying the topological structure of complex networks, which can be either defined for each node or edge. nd.centrality offers 3 distance measures on node-defined centralities. See this Wikipedia page for more on network/graph centrality.

Usage

1
2
3
4
5
6
nd.centrality(
  A,
  out.dist = TRUE,
  mode = c("Degree", "Close", "Between"),
  directed = FALSE
)

Arguments

A

a list of length N containing (M\times M) adjacency matrices.

out.dist

a logical; TRUE for computed distance matrix as a dist object.

mode

type of node centrality definitions to be used.

directed

a logical; FALSE as symmetric, undirected graph.

Value

a named list containing

D

an (N\times N) matrix or dist object containing pairwise distance measures.

features

an (N\times M) matrix where rows are node centralities for each graph.

References

\insertRef

roy_modeling_2014NetworkDistance

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## load example data
data(graph20)

## use 3 types of centrality measures
out1 <- nd.centrality(graph20, out.dist=FALSE,mode="Degree")
out2 <- nd.centrality(graph20, out.dist=FALSE,mode="Close")
out3 <- nd.centrality(graph20, out.dist=FALSE,mode="Between")

## visualize
opar = par(no.readonly=TRUE)
par(mfrow=c(1,3), pty="s")
image(out1$D[,20:1], main="Degree", col=gray(0:32/32), axes=FALSE)
image(out2$D[,20:1], main="Close", col=gray(0:32/32), axes=FALSE)
image(out3$D[,20:1], main="Between", col=gray(0:32/32), axes=FALSE)
par(opar)

NetworkDistance documentation built on Aug. 21, 2021, 5:07 p.m.