'reverse the direction of the edges whose source-node-partail_order> destination-node-partail_order
to make the graph acyclic'

def rev_edges(self, tree):

    Is_Cyclic = False
    i = 0
    for link in self.links:
        src = link[0]
        des = link[1]
        edge_len = (self.partial_order[des]['level'] - self.partial_order[src]['level'])
        if (edge_len < 0):
            del self.links[i]
            self.links.insert(i, (des, src))
            self.transitions[src].remove(des)
            self.transitions.setdefault(des, []).append(src)
            Is_Cyclic = True
        elif (math.fabs(edge_len) > 1):
            Is_Cyclic = True
        i += 1
    return Is_Cyclic
