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 |
k |
the integer order of moments. If |
metric |
type of distance measures for log-moment features. See |
out.dist |
a logical; |
Value
a named list containing
- D
an
(N\times N)
matrix ordist
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)