dist_sim_matrix: Structural similarities

View source: R/similarities.R

dist_sim_matrixR Documentation

Structural similarities

Description

In the literature of social network, Euclidean distance (Burt, 1976) or correlations (Wasserman and Faust, 1994) were considered as measures of structural equivalence.

Usage

dist_sim_matrix(
  A,
  method = c("euclidean", "hamming", "jaccard"),
  bipartite = FALSE
)

Arguments

A

A matrix

method

The similarities/distance currently available are either Euclidean (default), Hamming, or Jaccard.

bipartite

Whether the object is an incidence matrix

Value

This function returns a distance matrix between nodes of the same matrix.

Author(s)

Alejandro Espinosa-Rada

References

Burt, Ronald S. (1976) Positions in networks. Social Forces, 55(1): 93-122.

Wasserman, S. and Faust, K. (1994). Social network analysis: Methods and applications. Cambridge University Press.

Examples

A <- matrix(c(
  0, 1, 0, 0, 1,
  0, 0, 0, 1, 1,
  0, 1, 0, 0, 1,
  0, 0, 1, 1, 0,
  0, 1, 0, 0, 0
), nrow = 5, ncol = 5, byrow = TRUE)
rownames(A) <- letters[1:nrow(A)]
colnames(A) <- rownames(A)
dist_sim_matrix(A, method = "jaccard")

A <- matrix(c(
  0, 0, 3, 0, 5,
  0, 0, 2, 0, 4,
  5, 4, 0, 4, 0,
  0, 3, 0, 1, 0,
  0, 0, 0, 0, 2
), nrow = 5, ncol = 5, byrow = TRUE)
dist_sim_matrix(A, method = "euclidean")

anespinosa/netmem documentation built on April 5, 2025, 5:02 p.m.