관리-도구
편집 파일: graphlib.cpython-311.pyc
� c��f�% � �r � d dl mZ ddgZdZdZ G d� d� � Z G d� de� � Z G d � d� � Zd S )� )�GenericAlias�TopologicalSorter� CycleError������c � � e Zd ZdZd� ZdS )� _NodeInfo��node� npredecessors� successorsc �0 � || _ d| _ g | _ d S �Nr r )�selfr s �//opt/alt/python311/lib64/python3.11/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 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 d�Zd� 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� _nfinished�items�add)r �graphr �predecessorss r r zTopologicalSorter.__init__, sq � ���� �����������&+�k�k�m�m� .� .�"��l�����-��-�-�-�-�-� �� .� .r c �p � | j � |� � x}�t |� � x| j |<