code: def initialize_spanning_tree(self, n, faux_inf):
      self.edge_count = len(self.edge_indices)  # number of edges
      self.edge_flow = list(
          chain(
              repeat(0, self.edge_count),
              (abs(d) for d in self.node_demands),
          )
      )  # edge flows
      self.node_potentials = [
          faux_inf if d <= 0 else -faux_inf for d in self.node_demands
      ]  # node potentials
      self.parent = list(chain(repeat(-1, n), [None]))  # parent nodes
      self.parent_edge = list(
          range(self.edge_count, self.edge_count + n)
      )  # edges to parents
      self.subtree_size = list(
          chain(repeat(1, n), [n + 1])
      )  # subtree sizes
      self.next_node_dft = list(
          chain(range(1, n), [-1, 0])
      )  # next nodes in depth-first thread
      self.prev_node_dft = list(
          range(-1, n)
      )  # previous nodes in depth-first thread
      self.last_descendent_dft = list(
          chain(range(n), [n - 1])
      )  # last descendants in depth-first thread
      self._spanning_tree_initialized = True
  
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 2 for calling the _DataEssentialsAndFunctions obj's underlying member method code with example usage: obj.initialize_spanning_tree(n, faux_inf) without return types