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",">","`","_"]
code: def _update_edges(self):
      max_node_id = len(self._multi_graph) - 1
      max_node = self.get_node(max_node_id).op
  
      for current_node_id in range(0, max_node_id):
          self.get_node(current_node_id).reachable = True
  
      for prev_node_id in range(max_node_id - 1, -1, -1):
          if self.get_node(
              prev_node_id
          ).reachable and not qml.is_commuting(
              self.get_node(prev_node_id).op, max_node
          ):
              self.add_edge(prev_node_id, max_node_id)
              self._pred_update(max_node_id)
              list_predecessors = self.get_node(
                  max_node_id
              ).predecessors
              for pred_id in list_predecessors:
                  self.get_node(pred_id).reachable = False
  
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 18 for calling the CommutationDAG obj's underlying member method code with example usage: obj._update_edges() without return types