def connect_graphs(self, sets_orig, edges_orig):
        master_graph = max(sets_orig, key=len)
        sets = sets_orig.copy()
        edges = np.array([], dtype=object)
        sets.remove(master_graph)
        master_tree = cKDTree(self.nodes[list(master_graph)])
        for s in sets:
            x = np.array(list(s))
            nearests = np.array([master_tree.query(self.nodes[v]) for v in x])
            tails = nearests[
                nearests[:, 0].argsort()][:, 1][:self.max_neighbours]
            heads = x[nearests[:, 0].argsort()][:self.max_neighbours]
            for head, tail in zip(heads, tails):
                edges = np.append(edges, None)
                edges[-1] = (head, tail)
                edges = np.append(edges, None)
                edges[-1] = (tail, head)
        return edges
Check whether `s_indices` and `a_indices` are sorted in
dataset/ETHPy150Open dnlcrl/PyGraphArt/src/graph.py/Graph.connect_graphs--crossover with--dataset/ETHPy150Open QuantEcon/QuantEcon.py/quantecon/markov/ddp.py/_has_sorted_sa_indices