def _first_K_cluster(self, k):

        parents = _np.array([u for u, v in self.nodes.items()
                             if len(v.children) > 0])
        roots = [u for u, v in self.nodes.items() if v.parent is None]
        splits = [self.nodes[u].end_level for u in parents]
        order = _np.argsort(splits)
        star_parents = parents[order[:(k - len(roots))]]

        children = [u for u, v in self.nodes.items() if v.parent is None]
        for u in star_parents:
            children += self.nodes[u].children

        nodes = [x for x in children if
                 sum(_np.in1d(self.nodes[x].children, children)) == 0]

        points = []
        cluster = []

        for c in nodes:
            cluster_pts = self.nodes[c].members
            points.extend(cluster_pts)
            cluster += ([c] * len(cluster_pts))

        labels = _np.array([points, cluster], dtype=_np.int).T
        return labels
Returns foreground cluster labels for the 'k' modes with the lowest
dataset/ETHPy150Open CoAxLab/DeBaCl/debacl/level_set_tree.py/LevelSetTree._first_K_cluster