View source: R/get_jaccard_similarity.R
get_jaccard_similarity | R Documentation |
Get the Jaccard similarity coefficient scores for one or more nodes in a graph.
get_jaccard_similarity(graph, nodes = NULL, direction = "all", round_to = 3)
graph |
A graph object of class |
nodes |
An optional vector of node IDs to consider for Jaccard similarity scores. If not supplied, then similarity scores will be provided for every pair of nodes in the graph. |
direction |
Using |
round_to |
The maximum number of decimal places to retain for the
Jaccard similarity coefficient scores. The default value is |
A matrix with Jaccard similarity values for each pair of nodes considered.
# Create a random graph using the
# `add_gnm_graph()` function
graph <-
create_graph(
directed = FALSE) %>%
add_gnm_graph(
n = 10,
m = 15,
set_seed = 23)
# Get the Jaccard similarity
# values for nodes `5`, `6`,
# and `7`
graph %>%
get_jaccard_similarity(
nodes = 5:7)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.