'Convert a set of pairs into an adjacency linked list encoding of a graph.'

def _make_graph(self, s):

    g = {}
    for (x, y) in s:
        if (x in g):
            g[x].append(y)
        else:
            g[x] = [y]
    return g
