class_docstr: Automagic DGL models from Graphistry Instances.
class_docstr_tok: ["Automagic","DGL","models","from","Graphistry","Instances","."]
code: def _remove_edges_not_in_nodes(self, node_column: str):
      # need to do this so we get the correct ndata size ...
      if self._nodes is None:
          res = self.materialize_nodes()
          nodes = res._nodes[res._node]
      else:
          nodes = self._nodes[node_column]
  
      if self._source is None or self._destination is None:
          raise ValueError(
              "Need to have source and destination columns bound, call bind() or edges()"
          )
  
      if not isinstance(self._edges, pd.DataFrame):  # type: ignore
          raise ValueError("self._edges for DGLGraphMix must be pd.DataFrame, recieved: %s", type(self._edges))  # type: ignore
      edf: pd.DataFrame = self._edges  # type: ignore
      n_initial = len(edf)
      logger.info(f"Length of edge DataFrame {n_initial}")
  
      mask: pd.Series[bool] = edf[self._source].isin(nodes) & edf[self._destination].isin(nodes)  # type: ignore
      # print(f'MASK: length: {len(mask)}')
      # print(f'OG: length: {len(edf)}')
  
      assert (
          sum(mask) > 2
      ), f"mask slice is (practically) empty, will lead to bad graph, found {sum(mask)}"
      self._MASK = mask  # type: ignore
      self._edges = edf[mask]  # type: ignore
  
      logger.debug(f"new EDGES: length: {len(self._edges)}")
  
      self._prune_edge_target()
      n_final = len(self._edges)
      logger.info(f"-Length of edge DataFrame {n_final} after pruning")
      n_final = len(self._edges)
      if n_final != n_initial:
          logger.warning(
              "** Original Edge DataFrame has been changed, some elements have been dropped **"
          )
      self._removed_edges_previously = True
  
imports: from collections import Counter
  from typing import Dict, Optional, TYPE_CHECKING, Tuple
  import numpy
  import pandas
  from .None import constants
  from .feature_utils import FeatureEngine, FeatureMixin, resolve_feature_engine, XSymbolic, YSymbolic, resolve_X, resolve_y
  from .util import setup_logger
label_desc: Use image node_id 4 for calling the DGLGraphMixin obj's underlying member method code with example usage: obj._remove_edges_not_in_nodes(node_column) without return types