'Compute the transitive closure of a graph represented as a linked list.'

def _transclose(self, g):

    for x in g:
        for adjacent in g[x]:
            if (adjacent in g):
                for y in g[adjacent]:
                    if (y not in g[x]):
                        g[x].append(y)
    return g
