U
    hz                     @   sR   d dl mZ d dlZed ed d dlZd dlmZmZ G dd dZ	dS )    )defaultdictNZnumpyZscipy)communicabilitycommunicability_expc                   @   s   e Zd Zdd Zdd ZdS )TestCommunicabilityc                 C   sj   ddddddd}t td}| D ]8\}}|D ]*}|| | tj|| | ddks8tq8q,d S )NgOQu?gNğ?)r         Hz>abs)r   nxZ
path_graphitemspytestapproxAssertionError)selfanswerresultk1valk2 r   R/tmp/pip-unpacked-wheel-j2te_plx/networkx/algorithms/tests/test_communicability.pytest_communicability   s    	z(TestCommunicability.test_communicabilityc           	      C   s  ddddddddddddd	d
dddd
dddddddd}t t}| D ]\\}}}||| |< qHtddddddg}t|}| D ]8\}}|D ]*}|| | tj|| | ddkstqqt	|}| D ]8\}}|D ]*}|| | tj|| | ddkstqqd S )NgjXF{CP?gNH?g.9?g*J?g}~@gi<?g-{` @g+)X?g}~@g-{` @g^G<	@gTH?gJi|@))1r   )r   Albert)r   Aric)r   Dan)r   Franck)r   r   )r   r   )r   r   )r   r   r   r   )r   r   )r   r   )r   r   r   r   )r   r   r   r   r   r   )r   r   )r   r   )r   r   )r   r   r   r   r   r   )r   r   )r   r   r#   r   r!   r   r    r"   r   r	   )
r   dictr   r   ZGraphr   r   r   r   r   )	r   Zanswer_origr   r   r   vZG1r   r   r   r   r   test_communicability2   s\    *z)TestCommunicability.test_communicability2N)__name__
__module____qualname__r   r&   r   r   r   r   r      s   r   )
collectionsr   r   ZimportorskipZnetworkxr   Z'networkx.algorithms.communicability_algr   r   r   r   r   r   r   <module>   s   

