WOLFRAM

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)Summary of the most common use cases

Cosine similarity between two vertices in a graph:

Out[1]=1

Scope  (7)Survey of the scope of standard use cases

VertexCosineSimilarity works with undirected graphs:

Out[1]=1

Directed graphs:

Out[1]=1

Weighted graphs:

Out[1]=1

Multigraphs:

Out[1]=1

Mixed graphs:

Out[1]=1

Use rules to specify the graph:

Out[1]=1

VertexCosineSimilarity works with large graphs:

Out[2]=2

Properties & Relations  (3)Properties of the function, and connections to other functions

Use CosineDistance to compute the cosine similarity of a graph:

Out[4]=4

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

Out[1]=1

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

Out[1]=1
Wolfram Research (2012), VertexCosineSimilarity, Wolfram Language function, https://reference.wolfram.com/language/ref/VertexCosineSimilarity.html (updated 2015).
Wolfram Research (2012), VertexCosineSimilarity, Wolfram Language function, https://reference.wolfram.com/language/ref/VertexCosineSimilarity.html (updated 2015).

Text

Wolfram Research (2012), VertexCosineSimilarity, Wolfram Language function, https://reference.wolfram.com/language/ref/VertexCosineSimilarity.html (updated 2015).

Wolfram Research (2012), VertexCosineSimilarity, Wolfram Language function, https://reference.wolfram.com/language/ref/VertexCosineSimilarity.html (updated 2015).

CMS

Wolfram Language. 2012. "VertexCosineSimilarity." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2015. https://reference.wolfram.com/language/ref/VertexCosineSimilarity.html.

Wolfram Language. 2012. "VertexCosineSimilarity." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2015. https://reference.wolfram.com/language/ref/VertexCosineSimilarity.html.

APA

Wolfram Language. (2012). VertexCosineSimilarity. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/VertexCosineSimilarity.html

Wolfram Language. (2012). VertexCosineSimilarity. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/VertexCosineSimilarity.html

BibTeX

@misc{reference.wolfram_2025_vertexcosinesimilarity, author="Wolfram Research", title="{VertexCosineSimilarity}", year="2015", howpublished="\url{https://reference.wolfram.com/language/ref/VertexCosineSimilarity.html}", note=[Accessed: 16-April-2025 ]}

@misc{reference.wolfram_2025_vertexcosinesimilarity, author="Wolfram Research", title="{VertexCosineSimilarity}", year="2015", howpublished="\url{https://reference.wolfram.com/language/ref/VertexCosineSimilarity.html}", note=[Accessed: 16-April-2025 ]}

BibLaTeX

@online{reference.wolfram_2025_vertexcosinesimilarity, organization={Wolfram Research}, title={VertexCosineSimilarity}, year={2015}, url={https://reference.wolfram.com/language/ref/VertexCosineSimilarity.html}, note=[Accessed: 16-April-2025 ]}

@online{reference.wolfram_2025_vertexcosinesimilarity, organization={Wolfram Research}, title={VertexCosineSimilarity}, year={2015}, url={https://reference.wolfram.com/language/ref/VertexCosineSimilarity.html}, note=[Accessed: 16-April-2025 ]}