@staticmethod
def _convert_matrix_to_tuple_repr(merges, n=None):
    'Converts the matrix representation of a clustering to a tuple\n        representation.\n\n        @param merges: the matrix representation of the clustering\n        @return: the tuple representation of the clustering\n        '
    if (n is None):
        n = (len(merges) + 1)
    tuple_repr = range(n)
    idxs = range(n)
    for (rowidx, row) in enumerate(merges):
        (i, j) = row
        try:
            (idxi, idxj) = (idxs[i], idxs[j])
            tuple_repr[idxi] = (tuple_repr[idxi], tuple_repr[idxj])
            tuple_repr[idxj] = None
        except IndexError:
            raise ValueError(('malformed matrix, subgroup referenced ' + ('before being created in step %d' % rowidx)))
        idxs.append(j)
    return [x for x in tuple_repr if (x is not None)]
Converts the matrix representation of a clustering to a tuple
representation.

@param merges: the matrix representation of the clustering
@return: the tuple representation of the clustering
@staticmethod
def _convert_matrix_to_tuple_repr(merges, n=None):
    'Converts the matrix representation of a clustering to a tuple\n        representation.\n\n        @param merges: the matrix representation of the clustering\n        @return: the tuple representation of the clustering\n        '
    if (n is None):
        n = (len(merges) + 1)
    tuple_repr = range(n)
    idxs = range(n)
    for (rowidx, row) in enumerate(merges):
        (i, j) = row
        try:
            (idxi, idxj) = (idxs[i], idxs[j])
            tuple_repr[idxi] = (tuple_repr[idxi], tuple_repr[idxj])
            tuple_repr[idxj] = None
        except IndexError:
            raise ValueError(('malformed matrix, subgroup referenced ' + ('before being created in step %d' % rowidx)))
        idxs.append(j)
    return [x for x in tuple_repr if (x is not None)]