'Initialize graph\'s object
@param nodes list of ids of nodes in the graph
@param transitions list of edges in the graph in the form (source_node, destination_node)
@param no_ancester list of nodes with no incoming edges'

def __init__(self, nodes, transitions, no_ancester=None):

    self.nodes = (nodes or [])
    self.edges = (transitions or [])
    self.no_ancester = (no_ancester or {})
    trans = {}
    for t in transitions:
        trans.setdefault(t[0], [])
        trans[t[0]].append(t[1])
    self.transitions = trans
    self.result = {}
