split_join_distance

split_join_distance#

graph_tool.inference.split_join_distance(x, y)[git][source]#

Returns the split-join distance between two partitions.

Parameters:
xiterable of int values or PropertyMap

First partition.

yiterable of int values or PropertyMap

Second partition.

Returns:
dint

The split-join distance.

See also

rand_index

Rand index between partitions

variation_information

Variation of information between partitions

reduced_mutual_information

Reduced mutual information between partitions

partition_overlap

Maximum overlap between partitions

Notes

The split-join distance [dongen-performance-2000] is the number of elements that must be moved to transform one partition into the other, when the groups may only be split or joined,

\[d(\boldsymbol x,\boldsymbol y) = 2N - \sum_r\max_s n_{rs} - \sum_s\max_r n_{rs},\]

where \(n_{rs}\) is the number of elements in group \(r\) of \(\boldsymbol x\) and group \(s\) of \(\boldsymbol y\), i.e. the sum of the “projection distances” \(N - \sum_r\max_s n_{rs}\) and \(N - \sum_s\max_r n_{rs}\) of each partition onto the other. This algorithm runs in time \(O(N)\).

References

[dongen-performance-2000]

Stijn van Dongen, “Performance criteria for graph clustering and Markov cluster experiments”, Technical Report INS-R0012, Centrum voor Wiskunde en Informatica (2000).

Examples

>>> x = [0, 0, 0, 1, 1, 1]
>>> y = [0, 0, 1, 1, 2, 2]
>>> print(gt.split_join_distance(x, y))
3