get_dice_similarity {DiagrammeR} | R Documentation |
Get Dice similarity coefficient scores
Description
Get the Dice similarity coefficient scores for one or more nodes in a graph.
Usage
get_dice_similarity(graph, nodes = NULL, direction = "all", round_to = 3)
Arguments
graph |
A graph object of class |
nodes |
an optional vector of node IDs to consider for Dice 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 Dice
similarity coefficient scores. The default value is |
Value
A matrix with Dice similarity values for each pair of nodes considered.
Examples
# 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 Dice similarity
# values for nodes `5`, `6`,
# and `7`
graph %>%
get_dice_similarity(
nodes = 5:7)
[Package DiagrammeR version 1.0.11 Index]