'Finds the optimized rank of the nodes using Network-simplex algorithm'

def rank(self):

    self.levels = {}
    self.critical_edges = []
    self.partial_order = {}
    self.links = []
    self.Is_Cyclic = False
    self.tree_list[self.start] = self.make_acyclic(None, self.start, 0, [])
    self.Is_Cyclic = self.rev_edges(self.tree_list[self.start])
    self.process_ranking(self.start)
    self.init_rank()
    e = self.leave_edge()
    while e:
        f = self.enter_edge(e)
        if (e == f):
            self.critical_edges.append(e)
        else:
            self.exchange(e, f)
        e = self.leave_edge()
    self.normalize()
    for edge in self.edge_wt:
        self.edge_wt[edge] = (self.result[edge[1]]['x'] - self.result[edge[0]]['x'])
