'Computes initial feasible ranking after making graph acyclic with depth-first search'

def process_ranking(self, node, level=0):

    if (node not in self.result):
        self.result[node] = {'y': None, 'x': level, 'mark': 0}
    elif (level > self.result[node]['x']):
        self.result[node]['x'] = level
    if (self.result[node]['mark'] == 0):
        self.result[node]['mark'] = 1
        for sec_end in self.transitions.get(node, []):
            self.process_ranking(sec_end, (level + 1))
