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 |
y |
An |
representation |
A string specifying the desired type of representation,
among: |
matching_iterations |
An integer value specifying the maximum number of
runs when looking for the optimal permutation for graph matching. Defaults
to |
target_matrix |
A square numeric matrix of size |
Details
Let be the matrix representation of network
and
be
the matrix representation of network
. The Hamming distance between
and
is given by
where is the number of vertices in networks
and
. The Frobenius distance between
and
is given by
The spectral distance between
and
is given by
where
and
of the eigenvalues of
and
, respectively.
This distance gives rise to classes of equivalence. Consider the spectral
decomposition of
and
:
and
where and
are the matrices whose columns are the
eigenvectors of
and
, respectively and
and
are
the diagonal matrices with elements the eigenvalues of
and
,
respectively. The root-Euclidean distance between
and
is
given by
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")