o
    3ήcP	                     @   s*   d Z ddlZddlmZ G dd dZdS )z
====================
Generators - Non Isomorphic Trees
====================

Unit tests for WROM algorithm generator in generators/nonisomorphic_trees.py
    N)edges_equalc                   @   s4   e Zd Zdd Zdd Zdd Zdd Zd	d
 ZdS )TestGeneratorNonIsomorphicTreesc                 C   sD   dd }|dD ]	}t |sJ q|dD ]	}t |sJ qd S )Nc                 S      t t| S Nlistnxnonisomorphic_treesx r   Y/tmp/pip-target-vg8gfxp4/lib/python/networkx/generators/tests/test_nonisomorphic_trees.pyf      z>TestGeneratorNonIsomorphicTrees.test_tree_structure.<locals>.f      )r   is_tree)selfr   ir   r   r   test_tree_structure   s   z3TestGeneratorNonIsomorphicTrees.test_tree_structurec                 C   s   dd }|d}t t|D ]}t |d t|D ]}t|| || r'J qq|d}t t|D ]}t |d t|D ]}t|| || rLJ q>q3d S )Nc                 S   r   r   r   r
   r   r   r   r      r   z>TestGeneratorNonIsomorphicTrees.test_nonisomorphism.<locals>.fr      r   )rangelenr   is_isomorphic)r   r   treesr   jr   r   r   test_nonisomorphism   s   z3TestGeneratorNonIsomorphicTrees.test_nonisomorphismc                 C   s   t ddks	J t ddksJ t ddksJ t ddks$J t ddks-J t ddks6J t d	d
ks?J d S )N   r            r         r      )r   number_of_nonisomorphic_trees)r   r   r   r   "test_number_of_nonisomorphic_trees%   s   zBTestGeneratorNonIsomorphicTrees.test_number_of_nonisomorphic_treesc                 C   sf   dd }t |dd  ddgsJ t |dd  g ds"J t |dd	  g d
s1J d S )Nc                 S   r   r   r   r
   r   r   r   r   0   r   zCTestGeneratorNonIsomorphicTrees.test_nonisomorphic_trees.<locals>.fr   r   r   r   r   r   r   )r&   r   r   )r   r   r   )r&   r'   r(   )r   edges)r   r   r   r   r   test_nonisomorphic_trees/   s   "z8TestGeneratorNonIsomorphicTrees.test_nonisomorphic_treesc                 C   s   ddgddggg}t tjddd|ksJ g dg dg dgg}t tjddd|ks/J g d	g d
g dg dgg dg dg dg dgg}t tjddd|ksXJ d S )Nr   r   r   matrix)create)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   trees_2trees_3trees_4r   r   r   test_nonisomorphic_trees_matrix7   s   z?TestGeneratorNonIsomorphicTrees.test_nonisomorphic_trees_matrixN)__name__
__module____qualname__r   r   r%   r*   r0   r   r   r   r   r      s    

r   )__doc__networkxr   networkx.utilsr   r   r   r   r   r   <module>   s    