# VertexCosineSimilarity

VertexCosineSimilarity[g,u,v]

gives the cosine similarity between vertices u and v of the graph g.

VertexCosineSimilarity[{vw,},]

uses rules vw to specify the graph g.

# Details • The vertex cosine similarity is also known as Salton similarity.
• The vertex cosine similarity is the number of common neighbors of u and v divided by the geometric mean of their degrees.
• VertexCosineSimilarity works with undirected graphs, directed graphs, weighted graphs, multigraphs, and mixed graphs.

# Examples

open allclose all

## Basic Examples(1)

Cosine similarity between two vertices in a graph:

## Scope(7)

VertexCosineSimilarity works with undirected graphs:

Directed graphs:

Weighted graphs:

Multigraphs:

Mixed graphs:

Use rules to specify the graph:

VertexCosineSimilarity works with large graphs:

## Properties & Relations(3)

Use CosineDistance to compute the cosine similarity of a graph:

The cosine similarity between two vertices is equal to zero if one of the vertices has degree zero:

The cosine similarity between two vertices is equal to one if they have the same neighbors: