✏️ 正在编辑: graphlib.cpython-312.pyc
路径:
/lib64/python3.12/__pycache__/graphlib.cpython-312.pyc
提示:
您可以编辑任何文件(包括二进制文件),但请注意不当修改可能导致文件损坏。
� �֦i�% � �^ � d dl mZ ddgZdZdZ G d� d� Z G d� de� Z G d � d� Zy )� )�GenericAlias�TopologicalSorter� CycleError������c � � e Zd ZdZd� Zy)� _NodeInfo��node� npredecessors� successorsc �. � || _ d| _ g | _ y �Nr r )�selfr s �!/usr/lib64/python3.12/graphlib.py�__init__z_NodeInfo.__init__ s � ��� � ��� ��� N)�__name__� __module__�__qualname__� __slots__r � r r r r s � �5�I�r r c � � e Zd ZdZy)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 � � � r c �^ � e Zd ZdZd d�Zd� Zd� Zd� Zd� Zd� Z d � Z d � Zd� Zd� Z ee� Zy)r zFProvides functionality to topologically sort a graph of hashable nodesNc � � i | _ d | _ d| _ d| _ |�,|j � D ] \ }} | j |g|��� � y y r )� _node2info�_ready_nodes�_npassedout� _nfinished�items�add)r �graphr �predecessorss r r zTopologicalSorter.__init__, sS � ���� �����������&+�k�k�m�"��l������-��-� '4� r c �t � | j j |� x}�t |� x| j |<