def find_topo_sort(node_list):
    'Given a list of nodes, return a topo ordering of nodes ending in them.\n\n    A simple algorithm is to do a post-order DFS traversal on the given nodes,\n    going backwards based on input edges. Since a node is added to the ordering\n    after all its predecessors are traversed due to post-order DFS, we get a\n    topological sort.\n\n    '
    visited = set()
    topo_order = []
    for node in node_list:
        topo_sort_dfs(node, visited, topo_order)
    return topo_order
Given a list of nodes, return a topo ordering of nodes ending in them.

A simple algorithm is to do a post-order DFS traversal on the given nodes,
going backwards based on input edges. Since a node is added to the ordering
after all its predecessors are traversed due to post-order DFS, we get a
topological sort.
def find_topo_sort(node_list):
    'Given a list of nodes, return a topo ordering of nodes ending in them.\n\n    A simple algorithm is to do a post-order DFS traversal on the given nodes,\n    going backwards based on input edges. Since a node is added to the ordering\n    after all its predecessors are traversed due to post-order DFS, we get a\n    topological sort.\n\n    '
    visited = set()
    topo_order = []
    for node in node_list:
        topo_sort_dfs(node, visited, topo_order)
    return topo_order