class_docstr: Iterate over all spanning arborescences of a graph in either increasing or
  decreasing cost.
  
  Notes
  -----
  This iterator uses the partition scheme from [1]_ (included edges,
  excluded edges and open edges). It generates minimum spanning
  arborescences using a modified Edmonds' Algorithm which respects the
  partition of edges. For arborescences with the same weight, ties are
  broken arbitrarily.
  
  References
  ----------
  .. [1] G.K. Janssens, K. Sörensen, An algorithm to generate all spanning
         trees in order of increasing cost, Pesquisa Operacional, 2005-08,
         Vol. 25 (2), p. 219-229,
         https://www.scielo.br/j/pope/a/XHswBwRwJyrfL88dmMwYNWp/?lang=en
docstr: Create new partitions based of the minimum spanning tree of the
  current minimum partition.
  
  Parameters
  ----------
  partition : Partition
      The Partition instance used to generate the current minimum spanning
      tree.
  partition_arborescence : nx.Graph
      The minimum spanning arborescence of the input partition.
code: def _partition(self, partition, partition_arborescence):
      """
      Create new partitions based of the minimum spanning tree of the
      current minimum partition.
  
      Parameters
      ----------
      partition : Partition
          The Partition instance used to generate the current minimum spanning
          tree.
      partition_arborescence : nx.Graph
          The minimum spanning arborescence of the input partition.
      """
      # create two new partitions with the data from the input partition dict
      p1 = self.Partition(0, partition.partition_dict.copy())
      p2 = self.Partition(0, partition.partition_dict.copy())
      for e in partition_arborescence.edges:
          # determine if the edge was open or included
          if e not in partition.partition_dict:
              # This is an open edge
              p1.partition_dict[e] = nx.EdgePartition.EXCLUDED
              p2.partition_dict[e] = nx.EdgePartition.INCLUDED
  
              self._write_partition(p1)
              try:
                  p1_mst = self.method(
                      self.G,
                      self.weight,
                      partition=self.partition_key,
                      preserve_attrs=True,
                  )
  
                  p1_mst_weight = p1_mst.size(weight=self.weight)
                  p1.mst_weight = (
                      p1_mst_weight if self.minimum else -p1_mst_weight
                  )
                  self.partition_queue.put(p1.__copy__())
              except nx.NetworkXException:
                  pass
  
              p1.partition_dict = p2.partition_dict.copy()
  
imports: import string
  from dataclasses import dataclass, field
  from enum import Enum
  from operator import itemgetter
  from queue import PriorityQueue
  import networkx
  from networkx.utils import py_random_state
  from .recognition import is_arborescence, is_branching
label_desc: Use image node_id 4 for calling the ArborescenceIterator obj's underlying member method code with example usage: obj._partition(partition, partition_arborescence) without return types