python (3.11.7)
e% r d dl mZ ddgZdZdZ G d d Z G d de Z G d d Zd
S ) )GenericAliasTopologicalSorter
CycleErrorc e Zd ZdZd ZdS ) _NodeInfonode
npredecessors
successorsc 0 || _ d| _ g | _ d S Nr r
)selfr s </BuggyBox/python/3.11.7/bootstrap/lib/python3.11/graphlib.py__init__z_NodeInfo.__init__ s
N)__name__
__module____qualname__ __slots__r r r r r s( 5I r r c e Zd ZdZdS )r aC Subclass of ValueError raised by TopologicalSorter.prepare if cycles
exist in the working graph.
If multiple cycles exist, only one undefined choice among them will be reported
and included in the exception. The detected cycle can be accessed via the second
element in the *args* attribute of the exception instance and consists in a list
of nodes, such that each node is, in the graph, an immediate predecessor of the
next node in the list. In the reported list, the first and the last node will be
the same, to make it clear that it is cyclic.
N)r r r __doc__r r r r r s Dr c f e Zd ZdZd
dZd Zd Zd Zd Zd Z d Z
d
Zd Zd Z
ee ZdS )r zFProvides functionality to topologically sort a graph of hashable nodesNc i | _ d | _ d| _ d| _ |(| D ]\ }} | j |g|R d S d S r )
_node2info_ready_nodes_npassedout
_nfinisheditemsadd)r graphr predecessorss r r zTopologicalSorter.__init__, sq &+kkmm
.
."l------
.
.r c p | j | x}t | x| j |<