code: def node_replace(
      self,
      old_node: Node,
      new_node: Node,
      input_slot_mapping=None,
      output_slot_mapping=None,
  ):
      # TODO: currently, only support single input slot and output slot.
      if (
          input_slot_mapping is not None
          or output_slot_mapping is not None
      ):
          raise ValueError("Slot mapping is not supported")
  
      phy_graph = old_node.graph
      new_node.graph = phy_graph
  
      new_node._register()
  
      for edge in phy_graph.edges:
          if edge.head == old_node:
              edge.head = new_node
          elif edge.tail == old_node:
              edge.tail = new_node
  
      # after the replacement, there might be multiple duplicated edges
      # with the same input and output nodes, which should be de-duplicated
      self._remove_duplicated_edges()
  
imports: import copy
  from typing import Dict, Tuple, Any, Type, cast
  from nni.common.device import Device, CPUDevice
  from nni.mutable.utils import uid
  from nni.nas.space import Edge, Graph, GraphModelSpace, Node
  from nni.nas.space.graph_op import Cell, Operation, _IOPseudoOperation
label_desc: Use image node_id 5 for calling the LogicalPlan obj's underlying member method code with example usage: obj.node_replace(old_node, new_node, input_slot_mapping, output_slot_mapping) without return types