code: def test__toposort():
      edges = {
          1: set((4, 6, 7)),
          2: set((4, 6, 7)),
          3: set((5, 7)),
          4: set((6, 7)),
          5: set((7,)),
      }
      order = _toposort(edges)
      assert not any(
          a in edges.get(b, ())
          for i, a in enumerate(order)
          for b in order[i:]
      )
  
file_path: Theano/theano/gof/tests/test_sched.py
imports: from __future__ import absolute_import, print_function, division
  from theano.gof.sched import make_dependence_cmp, sort_apply_nodes, reverse_dict, _toposort, posort
  from theano import tensor
  from theano.gof.graph import io_toposort
  from theano.compat import cmp
label_desc: Use image node_id 4 for calling a global function with example usage: test__toposort() without return types