VertexCosineSimilarity
✖
VertexCosineSimilarity
gives the cosine similarity between vertices u and v of 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 allBasic Examples (1)Summary of the most common use cases
Scope (7)Survey of the scope of standard use cases
VertexCosineSimilarity works with undirected graphs:

https://wolfram.com/xid/0k2yyinvid6qgzybpsy-zv6lj


https://wolfram.com/xid/0k2yyinvid6qgzybpsy-jxhjg5


https://wolfram.com/xid/0k2yyinvid6qgzybpsy-g83u6g


https://wolfram.com/xid/0k2yyinvid6qgzybpsy-15kl6n


https://wolfram.com/xid/0k2yyinvid6qgzybpsy-dkxgru

Use rules to specify the graph:

https://wolfram.com/xid/0k2yyinvid6qgzybpsy-bndh30

VertexCosineSimilarity works with large graphs:

https://wolfram.com/xid/0k2yyinvid6qgzybpsy-gw1usj

https://wolfram.com/xid/0k2yyinvid6qgzybpsy-h0c2nf

Properties & Relations (3)Properties of the function, and connections to other functions
Use CosineDistance to compute the cosine similarity of a graph:

https://wolfram.com/xid/0k2yyinvid6qgzybpsy-mrgwsi

https://wolfram.com/xid/0k2yyinvid6qgzybpsy-gt4ar2

https://wolfram.com/xid/0k2yyinvid6qgzybpsy-fn267z

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

https://wolfram.com/xid/0k2yyinvid6qgzybpsy-b59h1d

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

https://wolfram.com/xid/0k2yyinvid6qgzybpsy-f6tk9t

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