class_docstr: Unit test class for ancillary utilities. 
docstr: Tests topological sorting. 
docstr_tok: ["Tests","topological","sorting","."]
code: def test_kahn_topoligical_sort(self):
      """Tests topological sorting."""
      self.report("Testing topological sort.")
      A = dok_matrix((6, 6))
      A[0, 2] = 1
      A[1, 2] = 1
      A[1, 3] = 1
      A[2, 3] = 1
      A[2, 4] = 1
      A[4, 3] = 1
      A[5, 0] = 1
      A[5, 1] = 1
      sorted_order, has_cycles = graph_utils.kahn_topological_sort(A, 5)
      assert has_cycles == False
      assert sorted_order == [5, 0, 1, 2, 4, 3] or sorted_order == [
          5,
          1,
          0,
          2,
          4,
          3,
      ]
      # Now create a graph with cycles
      A[3, 0] = 1
      sorted_order, has_cycles = graph_utils.kahn_topological_sort(A, 5)
      assert has_cycles == True
  
file_path: dragonfly/dragonfly/utils/unittest_graph_utils.py
imports: import numpy
  from scipy.sparse import dok_matrix
  from time import clock
  from .None import graph_utils
  from .base_test_class import BaseTestClass, execute_tests
label_desc: Use image node_id 3 for calling the GraphUtilsTestCase obj's underlying member method code with example usage: obj.test_kahn_topoligical_sort() without return types