docstr: Update the potentials of the nodes in the subtree rooted at a node
  q connected to its parent p by an edge i.
docstr_tok: ["Update","the","potentials","of","the","nodes","in","the","subtree","rooted","at","a","node","q","connected","to","its","parent","p","by","an","edge","i","."]
code: def update_potentials(self, i, p, q):
      """
      Update the potentials of the nodes in the subtree rooted at a node
      q connected to its parent p by an edge i.
      """
      if q == self.edge_targets[i]:
          d = (
              self.node_potentials[p]
              - self.edge_weights[i]
              - self.node_potentials[q]
          )
      else:
          d = (
              self.node_potentials[p]
              + self.edge_weights[i]
              - self.node_potentials[q]
          )
      for q in self.trace_subtree(q):
          self.node_potentials[q] += d
  
imports: from itertools import chain, islice, repeat
  from math import ceil, sqrt
  import networkx
  from networkx.utils import not_implemented_for
label_desc: Use image node_id 11 for calling the _DataEssentialsAndFunctions obj's underlying member method code with example usage: obj.update_potentials(i, p, q) without return types