Start by identifying all the nodes that have no dependencies (incoming edges), and add those nodes to the candidates stack.
For every candidate, remove each of the candidate's outgoing edges from the graph, then add the candidate to the solution. When you remove a candidate's edge, if the child node the edge is connected to has no incoming edges, then add it to the candidates stack.
For every candidate, remove each of the candidate's outgoing edges from the graph, then add the candidate to the solution. When you remove a candidate's edge, if the child node the edge is connected to has no incoming edges, then add it to the candidates stack.
For every candidate, remove each of the candidate's outgoing edges from the graph, then add the candidate to the solution. When you remove a candidate's edge, if the child node the edge is connected to has no incoming edges, then add it to the candidates stack.
For every candidate, remove each of the candidate's outgoing edges from the graph, then add the candidate to the solution. When you remove a candidate's edge, if the child node the edge is connected to has no incoming edges, then add it to the candidates stack.