def get_direct_ancestors(G, list_of_nodes):
parents = []<EOL>for item in list_of_nodes:<EOL><INDENT>anc = G.predecessors(item)<EOL>for one in anc:<EOL><INDENT>parents.append(one)<EOL><DEDENT><DEDENT>return parents<EOL>
Returns a list of nodes that are the parents
from all of the nodes given as an argument.
This is for use in the parallel topo sort