nd.moments {NetworkDistance}R Documentation

Log Moments Distance

Description

For a graph with an adjacency matrix A, graph moment is defined as

\rho_m (A) = tr(A/n)^m

where n is the number of vertices and m is an order of the moment. nd.moments computes pairwise distances based on log of graph moments from m=1 to m=k.

Usage

nd.moments(
  A,
  k = 3,
  metric = c("euclidean", "maximum", "manhattan", "canberra", "binary", "minkowski"),
  out.dist = TRUE
)

Arguments

A

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

k

the integer order of moments. If k is too large, it may incur numerical overflow.

metric

type of distance measures for log-moment features. See dist for more details.

out.dist

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

Value

a named list containing

D

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

References

Mukherjee SS, Sarkar P, Lin L (2017). “On clustering network-valued data.” In Guyon I, Luxburg UV, Bengio S, Wallach H, Fergus R, Vishwanathan S, Garnett R (eds.), Advances in neural information processing systems 30, 7071–7081. Curran Associates, Inc.

Examples

## load example data
data(graph20)

## compute distance based on different k's.
out3 <- nd.moments(graph20, k=3, out.dist=FALSE)
out5 <- nd.moments(graph20, k=5, out.dist=FALSE)
out7 <- nd.moments(graph20, k=7, out.dist=FALSE)
out9 <- nd.moments(graph20, k=9, out.dist=FALSE)

## visualize
opar = par(no.readonly=TRUE)
par(mfrow=c(2,2), pty="s")
image(out3$D[,20:1], col=gray(0:32/32), axes=FALSE, main="k=3")
image(out5$D[,20:1], col=gray(0:32/32), axes=FALSE, main="k=5")
image(out7$D[,20:1], col=gray(0:32/32), axes=FALSE, main="k=7")
image(out9$D[,20:1], col=gray(0:32/32), axes=FALSE, main="k=9")
par(opar)


[Package NetworkDistance version 0.3.4 Index]