'Computes rank of the nodes of the graph by finding initial feasible tree'

def init_rank(self):

    self.edge_wt = {}
    for link in self.links:
        self.edge_wt[link] = (self.result[link[1]]['x'] - self.result[link[0]]['x'])
    tot_node = len(self.partial_order)
    while (self.tight_tree() < tot_node):
        list_node = []
        list_edge = []
        for node in self.nodes:
            if (node not in self.reachable_nodes):
                list_node.append(node)
        for edge in self.edge_wt:
            if (edge not in self.tree_edges):
                list_edge.append(edge)
        slack = 100
        for edge in list_edge:
            if (((edge[0] in self.reachable_nodes) and (edge[1] not in self.reachable_nodes)) or ((edge[1] in self.reachable_nodes) and (edge[0] not in self.reachable_nodes))):
                if (slack > (self.edge_wt[edge] - 1)):
                    slack = (self.edge_wt[edge] - 1)
                    new_edge = edge
        if (new_edge[0] not in self.reachable_nodes):
            delta = (- (self.edge_wt[new_edge] - 1))
        else:
            delta = (self.edge_wt[new_edge] - 1)
        for node in self.result:
            if (node in self.reachable_nodes):
                self.result[node]['x'] += delta
        for edge in self.edge_wt:
            self.edge_wt[edge] = (self.result[edge[1]]['x'] - self.result[edge[0]]['x'])
    self.init_cutvalues()
