class_docstr: Sampler class that wraps an existing sampler for node classification into another
  one for edge classification or link prediction.
  
  See also
  --------
  as_edge_prediction_sampler
class_docstr_tok: ["Sampler","class","that","wraps","an","existing","sampler","for","node","classification","into","another","one","for","edge","classification","or","link","prediction",".","See","also","--","--","--","--","as_edge_prediction_sampler"]
code: def _build_neg_graph(self, g, seed_edges):
      neg_srcdst = self.negative_sampler(g, seed_edges)
      if not isinstance(neg_srcdst, Mapping):
          assert len(g.canonical_etypes) == 1, (
              "graph has multiple or no edge types; "
              "please return a dict in negative sampler."
          )
          neg_srcdst = {g.canonical_etypes[0]: neg_srcdst}
  
      dtype = F.dtype(list(neg_srcdst.values())[0][0])
      ctx = (
          context_of(seed_edges) if seed_edges is not None else g.device
      )
      neg_edges = {
          etype: neg_srcdst.get(
              etype,
              (
                  F.copy_to(F.tensor([], dtype), ctx=ctx),
                  F.copy_to(F.tensor([], dtype), ctx=ctx),
              ),
          )
          for etype in g.canonical_etypes
      }
      neg_pair_graph = heterograph(
          neg_edges, {ntype: g.num_nodes(ntype) for ntype in g.ntypes}
      )
      return neg_pair_graph
  
imports: import inspect
  from collections.abc import Mapping
  from ..None import backend
  from ..base import EID, NID
  from ..convert import heterograph
  from ..frame import LazyFeature
  from ..transforms import compact_graphs
  from ..utils import context_of, recursive_apply
label_desc: Use image node_id 2 for calling the EdgePredictionSampler obj's underlying member method code with example usage: obj._build_neg_graph(g, seed_edges) and returns: neg_pair_graph