def _get_ordering_ints(self, old_graph, free_vars=[]):
    best_peo = None
    best_width = np.inf
    best_widths = None
    for i in range(self.repeats):
        graph = copy.deepcopy(old_graph)
        peo = []
        widths = []
        while graph.number_of_nodes():
            ngs = np.array(list(map(len, map(operator.itemgetter(1), graph.adjacency()))))
            weights = np.exp(((- (ngs - np.min(ngs))) / self.temp))
            distrib = np.array(([0] + list(reducelist((lambda x, y: (x + y)), weights, 0))))
            rnd = (np.random.random() * distrib[(- 1)])
            bool_map = (distrib < rnd)
            select_map = (bool_map[1:] ^ bool_map[:(- 1)])
            selected_elem = np.array(list(graph.nodes))[select_map]
            assert (len(selected_elem) == 1), 'Error in algorithm, please submit an issue'
            selected_node = selected_elem[0]
            utils.eliminate_node_no_structure(graph, selected_node)
            peo.append(int(selected_node))
            widths.append(int(ngs[select_map][0]))
        if (max(widths) < best_width):
            best_peo = peo
            best_widths = widths
            best_width = max(widths)
    return (best_peo, best_widths)
def _get_ordering_ints(self, old_graph, free_vars=[]):
    best_peo = None
    best_width = np.inf
    best_widths = None
    for i in range(self.repeats):
        graph = copy.deepcopy(old_graph)
        peo = []
        widths = []
        while graph.number_of_nodes():
            ngs = np.array(list(map(len, map(operator.itemgetter(1), graph.adjacency()))))
            weights = np.exp(((- (ngs - np.min(ngs))) / self.temp))
            distrib = np.array(([0] + list(reducelist((lambda x, y: (x + y)), weights, 0))))
            rnd = (np.random.random() * distrib[(- 1)])
            bool_map = (distrib < rnd)
            select_map = (bool_map[1:] ^ bool_map[:(- 1)])
            selected_elem = np.array(list(graph.nodes))[select_map]
            assert (len(selected_elem) == 1), 'Error in algorithm, please submit an issue'
            selected_node = selected_elem[0]
            utils.eliminate_node_no_structure(graph, selected_node)
            peo.append(int(selected_node))
            widths.append(int(ngs[select_map][0]))
        if (max(widths) < best_width):
            best_peo = peo
            best_widths = widths
            best_width = max(widths)
    return (best_peo, best_widths)