R/similarity_cn.R

# 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]
}

Try the linkprediction package in your browser

Any scripts or data that you put into this service are public.

linkprediction documentation built on May 1, 2019, 9:58 p.m.