Alternative representation of group membership -
        creates a list with one tuple per group; each tuple contains
        the indices of its members

        Example:
        partition  = (0,0,0,1,0,1,2,2)
        membership = [(0,1,2,4), (3,5), (6,7)]

        :return: list of tuples giving group memberships by index

def get_membership(self):
        """
        Alternative representation of group membership -
        creates a list with one tuple per group; each tuple contains
        the indices of its members

        Example:
        partition  = (0,0,0,1,0,1,2,2)
        membership = [(0,1,2,4), (3,5), (6,7)]

        :return: list of tuples giving group memberships by index
        """
        result = defaultdict(list)
        for (position, value) in enumerate(self.partition_vector):
            result[value].append(position)
        return sorted([tuple(x) for x in result.values()])