distances {nevada}R Documentation

Distances Between Networks

Description

This is a collection of functions computing the distance between two networks.

Usage

dist_hamming(x, y, representation = "laplacian")

dist_frobenius(
  x,
  y,
  representation = "laplacian",
  matching_iterations = 0,
  target_matrix = NULL
)

dist_spectral(x, y, representation = "laplacian")

dist_root_euclidean(x, y, representation = "laplacian")

Arguments

x

An igraph::igraph object or a matrix representing an underlying network.

y

An igraph::igraph object or a matrix representing an underlying network. Should have the same number of vertices as x.

representation

A string specifying the desired type of representation, among: "adjacency", "laplacian", "modularity" or "graphon". Default is "laplacian".

matching_iterations

An integer value specifying the maximum number of runs when looking for the optimal permutation for graph matching. Defaults to 0L in which case no matching is done.

target_matrix

A square numeric matrix of size n equal to the order of the graphs specifying a target matrix towards which the initial doubly stochastic matrix is shrunk each time the graph matching algorithm fails to provide a good minimum. Defaults to NULL in which case the target matrix is automatically chosen between the identity matrix or the uniform matrix on the n-simplex.

Details

Let XX be the matrix representation of network xx and YY be the matrix representation of network yy. The Hamming distance between xx and yy is given by

1N(N1)i,jXijYij,\frac{1}{N(N-1)} \sum_{i,j} |X_{ij} - Y_{ij}|,

where NN is the number of vertices in networks xx and yy. The Frobenius distance between xx and yy is given by

i,j(XijYij)2.\sqrt{\sum_{i,j} (X_{ij} - Y_{ij})^2}.

The spectral distance between xx and yy is given by

i(aibi)2,\sqrt{\sum_i (a_i - b_i)^2},

where aa and bb of the eigenvalues of XX and YY, respectively. This distance gives rise to classes of equivalence. Consider the spectral decomposition of XX and YY:

X=VAV1X=VAV^{-1}

and

Y=UBU1,Y = UBU^{-1},

where VV and UU are the matrices whose columns are the eigenvectors of XX and YY, respectively and AA and BB are the diagonal matrices with elements the eigenvalues of XX and YY, respectively. The root-Euclidean distance between xx and yy is given by

i(VAV1UBU1)2.\sqrt{\sum_i (V \sqrt{A} V^{-1} - U \sqrt{B} U^{-1})^2}.

Root-Euclidean distance can used only with the laplacian matrix representation.

Value

A scalar measuring the distance between the two input networks.

Examples

g1 <- igraph::sample_gnp(20, 0.1)
g2 <- igraph::sample_gnp(20, 0.2)
dist_hamming(g1, g2, "adjacency")
dist_frobenius(g1, g2, "adjacency")
dist_spectral(g1, g2, "laplacian")
dist_root_euclidean(g1, g2, "laplacian")

[Package nevada version 0.2.0 Index]