ispairs#

er_evaluation.data_structures.ispairs(obj)[source]#

Check if given object is a pairs list.

A pairwise links list is an array of pairwise links between elements of the clustering, where each element of a cluster is linked to every other element of the same cluster. Note that clusters are unnamed in pairwise links lists. Example:

array([[0, 1],
       [0, 2],
       [1, 2],
       [3, 4]])
Returns:

True if a pairs list, False otherwise.

Return type:

bool

Examples

>>> from numpy import array
>>> obj = array([[0, 1], [0, 2], [1, 2], [3, 4]])
>>> ispairs(obj)
True
>>> obj = [[0, 1], [0, 2], [1, 2], [3, 4]]
>>> ispairs(obj)
False