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: Returns
  -------
  (multi)Graph
      The spanning tree of next greatest weight, which ties broken
      arbitrarily.
code: def __next__(self):
      """
      Returns
      -------
      (multi)Graph
          The spanning tree of next greatest weight, which ties broken
          arbitrarily.
      """
      if self.partition_queue.empty():
          del self.G, self.partition_queue
          raise StopIteration
  
      partition = self.partition_queue.get()
      self._write_partition(partition)
      next_arborescence = self.method(
          self.G,
          self.weight,
          partition=self.partition_key,
          preserve_attrs=True,
      )
      self._partition(partition, next_arborescence)
  
      self._clear_partition(next_arborescence)
      return next_arborescence
  
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 3 for calling the ArborescenceIterator obj's underlying member method code with example usage: obj.__next__() and returns: next_arborescence