code: def test_dfs_labeled_edges(idtype, example=False):
      dgl_g = dgl.graph([]).astype(idtype)
      dgl_g.add_nodes(6)
      dgl_g.add_edges([0, 1, 0, 3, 3], [1, 2, 2, 4, 5])
      dgl_edges, dgl_labels = dgl.dfs_labeled_edges_generator(
          dgl_g, [0, 3], has_reverse_edge=True, has_nontree_edge=True
      )
      dgl_edges = [toset(t) for t in dgl_edges]
      dgl_labels = [toset(t) for t in dgl_labels]
      g1_solutions = [
          # edges           labels
          [[0, 1, 1, 0, 2], [0, 0, 1, 1, 2]],
          [[2, 2, 0, 1, 0], [0, 1, 0, 2, 1]],
      ]
      g2_solutions = [
          # edges        labels
          [[3, 3, 4, 4], [0, 1, 0, 1]],
          [[4, 4, 3, 3], [0, 1, 0, 1]],
      ]
  
      def combine_frontiers(sol):
          es, ls = zip(*sol)
          es = [
              set(i for i in t if i is not None)
              for t in itertools.zip_longest(*es)
          ]
          ls = [
              set(i for i in t if i is not None)
              for t in itertools.zip_longest(*ls)
          ]
          return es, ls
  
      for sol_set in itertools.product(g1_solutions, g2_solutions):
          es, ls = combine_frontiers(sol_set)
          if es == dgl_edges and ls == dgl_labels:
              break
      else:
          assert False
  
file_path: dgl/tests/python/common/test_traversal.py
imports: import itertools
  import random
  import sys
  import time
  import unittest
  import backend
  import dgl
  import networkx
  import numpy
  import scipy.sparse
  from utils import parametrize_idtype
label_desc: Use image node_id 4 for calling a global function with example usage: test_dfs_labeled_edges(idtype, example) and returns: es,  ls