similarity_metrics {mcMST} | R Documentation |
Metrics for spanning tree comparisson.
Description
Functions which expect two (spanning) trees and return a measure
of similiarity between those. Function getNumberOfCommonEdges
returns
the (normalized) number of shared edges and function getSizeOfLargestCommonSubtree
returns the (normalized) size of the largest connected subtree which is located in
both trees.
Usage
getNumberOfCommonEdges(x, y, n = NULL, normalize = TRUE)
getSizeOfLargestCommonSubtree(x, y, n = NULL, normalize = TRUE)
Arguments
x |
[ |
y |
[ |
n |
[ |
normalize |
[ |
Value
[numeric(1)
] Measure
Examples
# Here we generate two random spanning trees of a complete
# graph with 10 nodes
set.seed(1)
st1 = prueferToEdgeList(sample(1:10, size = 8, replace = TRUE))
st2 = prueferToEdgeList(sample(1:10, size = 8, replace = TRUE))
# Now check the number of common edges
NCE = getNumberOfCommonEdges(st1, st2)
# And the size of the largest common subtree
SLS = getSizeOfLargestCommonSubtree(st1, st2)
[Package mcMST version 1.1.1 Index]