Skip to main content

split_join_distance

Function split_join_distance 

Source
pub fn split_join_distance(comm1: &[i64], comm2: &[i64]) -> Result<(i64, i64)>
Expand description

The two projection distances between two partitions, whose sum is the split-join distance of van Dongen.

For each set of the first partition the best matching (maximum overlap) set of the second one is found; the first distance is the number of elements minus the sum of these overlaps. The second distance is the same with the roles swapped. A distance is zero iff the corresponding partition is a refinement of the other one. Time complexity: O(n log n).

Binds igraph_split_join_distance.

§Errors

ErrorKind::InvalidValue if the lengths differ.

§Examples

use igraph::community::split_join_distance;
// Singletons refine the one-block partition:
assert_eq!(split_join_distance(&[0, 1, 2, 3, 4], &[0; 5]).unwrap(), (0, 4));