def list_of_nodes(inputs, outputs):
 return stack_search(deque([o.owner for o in outputs]), (lambda o: [inp.owner for inp in o.inputs if (inp.owner and (not any(((i in inp.owner.outputs) for i in inputs))))]))

def list_of_nodes ( inputs , outputs ) : return stack_search ( deque ( [ o . owner for o in outputs ] ) , ( lambda o : [ inp . owner for inp in o . inputs if ( inp . owner and ( not any ( ( ( i in inp . owner . outputs ) for i in inputs ) ) ) ) ] ) )
return the apply nodes of the graph between inputs and outputs .