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

def _make_pairs(self, g):

    pairs = []
    for node in g:
        for adjacent in g[node]:
            pairs.append((node, adjacent))
    return set(pairs)
