File: //usr/lib/python3/dist-packages/samba/kcc/__pycache__/graph_utils.cpython-310.pyc
o
�/a-0 � @ s� d dl Z d dlZd dlmZ d$dd�ZG dd� de�Zdd� Zd d
� Zdd� Z d
d� Z
dd� Zdd� Zdd� Z
dd� Zdd� Zdd� Zd%dd�Z d&d d!�Zd"d#� ZdS )'� N)� dot_graphc
K st t ||fd|i|��}|r| d|�dd� 7 } tj�|d| �}|d ur*|d| � t|d�} | �|� | �� d S )N�title�_�, � z%s.dotzwriting graph to %s�w)r �replace�os�path�join�open�write�close)
�basename� edge_list�vertices�label�dot_file_dir�debug�kwargs�s�filename�f� r �7/usr/lib/python3/dist-packages/samba/kcc/graph_utils.py�write_dot_file s
r c @ s e Zd ZdS )�
GraphErrorN)�__name__�
__module__�__qualname__r r r r r * s r c C sd |D ]-}t � }| D ]\}}||kr|�|� q ||kr |�|� q t|�d t|�kr/td��qdS )zXThe graph is complete, which is to say there is an edge between
every pair of nodes.� zgraph is not fully connectedN)�set�add�lenr )�edgesr �
edge_vertices�v�remotes�a�br r r �verify_graph_complete. s
���r* c
s� | st |�dkr
dS td��t| �}t|�� �� g }t|�D ]%\}}|\}}|� v r6� �|� |�|� q|� v rD� �|� |�|� q|sHnt|�D ]}||= qLq|s[� t|�krqd} | d� � fdd�t
|�D ��7 } t| ��dS ) z&There is a path between any two nodes.r Nz9all vertices are disconnected because there are no edges:TzHthe graph is not connected, as the following vertices are unreachable:
z
c 3 s � | ] }|� vr|V qd S �Nr )�.0r&