I have a problem where I would like to sort a set of nodes {a, b, c, d}. For each node I know the ancestors, i.e. those nodes that need to come before that node
{a, b, c, d}