class_docstr: Class to represent a quantum circuit as a directed acyclic graph (DAG). This class is useful to build the
  commutation DAG and set up all nodes attributes. The construction of the DAG should be used through the
  transform :class:`qml.transforms.commutation_dag`.
  
  Args:
      tape (.QuantumTape): PennyLane quantum tape representing a quantum circuit.
  
  **Reference:**
  
  [1] Iten, R., Moyard, R., Metger, T., Sutter, D. and Woerner, S., 2020.
  Exact and practical pattern matching for quantum circuit optimization.
  `doi.org/10.1145/3498325 <https://dl.acm.org/doi/abs/10.1145/3498325>`_
class_docstr_tok: ["Class","to","represent","a","quantum","circuit","as","a","directed","acyclic","graph","(","DAG",")",".","This","class","is","useful","to","build","the","commutation","DAG","and","set","up","all","nodes","attributes",".","The","construction","of","the","DAG","should","be","used","through","the","transform",":","class",":","`","qml.transforms.commutation_dag","`",".","Args",":","tape","(",".QuantumTape",")",":","PennyLane","quantum","tape","representing","a","quantum","circuit",".","*","*","Reference",":","*","*","[","1","]","Iten",",","R.",",","Moyard",",","R.",",","Metger",",","T.",",","Sutter",",","D.","and","Woerner",",","S.",",","2020",".","Exact","and","practical","pattern","matching","for","quantum","circuit","optimization",".","`","doi.org\/10.1145\/3498325","<","https",":","\/\/dl.acm.org\/doi\/abs\/10.1145\/3498325",">","`","_"]
docstr: Add the operation as a node in the DAG and updates the edges.
  
  Args:
      operation (qml.operation): PennyLane quantum operation to add to the DAG.
docstr_tok: ["Add","the","operation","as","a","node","in","the","DAG","and","updates","the","edges",".","Args",":","operation","(","qml.operation",")",":","PennyLane","quantum","operation","to","add","to","the","DAG","."]
code: def add_node(self, operation):
      """Add the operation as a node in the DAG and updates the edges.
  
      Args:
          operation (qml.operation): PennyLane quantum operation to add to the DAG.
      """
      target_wires = [
          w for w in operation.wires if w not in operation.control_wires
      ]
  
      new_node = CommutationDAGNode(
          op=operation,
          wires=operation.wires.tolist(),
          target_wires=target_wires,
          control_wires=operation.control_wires.tolist(),
          successors=[],
          predecessors=[],
      )
  
      self._add_node(new_node)
      self._update_edges()
  
imports: import heapq
  from collections import OrderedDict
  from functools import partial
  from typing import Sequence, Callable
  import networkx
  from networkx.drawing.nx_pydot import to_pydot
  import pennylane
  from pennylane.tape import QuantumTape
  from pennylane.wires import Wires
  from pennylane.transforms import transform
label_desc: Use image node_id 3 for calling the CommutationDAG obj's underlying member method code with example usage: obj.add_node(operation) without return types