R/similarity_cn.R

Defines functions similarity_cn

# Common neighbors vertex similarity
#
# Similarity measure counting number of common neighbors.
#
# This is a simple wrapper to an \pkg{igraph} function \code{cocitation},
#   which counts the number of neighbours shared by two vertices.
#
# @seealso \code{\link[igraph]{cocitation}}
#

similarity_cn <- function(graph, v1, v2, ...){
  score <- igraph::cocitation(graph, v = v1)
  score[, v2]
}
recon-icm/linkprediction documentation built on Jan. 19, 2024, 2:14 p.m.