I\'m looking for an algorithm to \"invert\" (reverse? turn inside-out?) a DAG:
A* # I can\'t ascii-art the arrows, so just
/ \\ # pretend
My intuitive suggestion would be to perform a Depth First traversal of your graph, and construct your mirrored graph simultaneously.
When traversing each node, create a new node in the mirrored graph, and create an edge between it and its predecessor in the new graph.
If at any point you reach a node which has no children, mark it as a root.