Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/pygraph/functions/__pycache__/connected_components.cpython-39.pyc
Ðазад
a ^�hl � @ s0 d Z ddlmZ ddlmZ dd� Zdd� Zd S ) z(Implements finding connected components.� )�deque� )� make_subgraphc C s� g }g }t | �� �}t� }t|�dkr�t|�dkr\|�� }|�|� |�|� g }|�|� t|�dkr|�� }||v r\|�|� |�|� | �|�}|D ]}||v r�|�|� q�q\q|S )z�Finds all connected components of the graph. Returns a list of lists, each containing the nodes that form a connected component. Returns an empty list for an empty graph. r ) �setZget_all_node_idsr �len�pop�add�append�removeZ neighbors)�graphZlist_of_components� componentZ unreachedZ to_explore�n�nodes� r ��/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/pygraph/functions/connected_components.py�get_connected_components s* r c s� t � �}g }|D ]�}t� }� fdd�|D �}|D ]B}|d D ]4}� �|�}|d \} } | |v r<| |v r<|�|� q<q0t|�}t� ||�}|�|� q|S )z�Finds all connected components of the graph. Returns a list of graph objects, each representing a connected component. Returns an empty list for an empty graph. c s g | ]}� � |��qS r )Zget_node)�.0�node�r r r � <listcomp>7 � z9get_connected_components_as_subgraphs.<locals>.<listcomp>�edgesZvertices)r r Zget_edger �listr r ) r � componentsZlist_of_graphs�cZedge_idsr r �e�edge�a�bZ list_of_edgesZsubgraphr r r �%get_connected_components_as_subgraphs, s r N)�__doc__�collectionsr Zhelpersr r r r r r r �<module> s $
| ver. 1.1 | |
.
| PHP 8.3.30 | Ð“ÐµÐ½ÐµÑ€Ð°Ñ†Ð¸Ñ Ñтраницы: 0 |
proxy
|
phpinfo
|
ÐаÑтройка