code: def check_random_walk(
      g, metapath, traces, ntypes, prob=None, trace_eids=None
  ):
      traces = F.asnumpy(traces)
      ntypes = F.asnumpy(ntypes)
      for j in range(traces.shape[1] - 1):
          assert ntypes[j] == g.get_ntype_id(
              g.to_canonical_etype(metapath[j])[0]
          )
          assert ntypes[j + 1] == g.get_ntype_id(
              g.to_canonical_etype(metapath[j])[2]
          )
  
      for i in range(traces.shape[0]):
          for j in range(traces.shape[1] - 1):
              assert g.has_edges_between(
                  traces[i, j], traces[i, j + 1], etype=metapath[j]
              )
              if prob is not None and prob in g.edges[metapath[j]].data:
                  p = F.asnumpy(g.edges[metapath[j]].data["p"])
                  eids = g.edge_ids(
                      traces[i, j], traces[i, j + 1], etype=metapath[j]
                  )
                  assert p[eids] != 0
              if trace_eids is not None:
                  u, v = g.find_edges(
                      trace_eids[i, j], etype=metapath[j]
                  )
                  assert (u == traces[i, j]) and (v == traces[i, j + 1])
  
imports: import unittest
  import warnings
  import backend
  import dgl
  import numpy
  import pytest
label_desc: Use image node_id 1 for calling a global function with example usage: check_random_walk(g, metapath, traces, ntypes, prob, trace_eids) without return types