o
    ִi
                     @   s0   d dl Z d dlZG dd dZG dd dZdS )    Nc                   @   sP   e Zd ZdZdd Zdd Zdd Zdd	 Zd
d Zdd Z	dd Z
dd ZdS )TestMinEdgeCoverz4Tests for :func:`networkx.algorithms.min_edge_cover`c                 C   s    t  }t |t ksJ d S N)nxGraphmin_edge_coversetselfG r   Z/home/kuhnn/.local/lib/python3.10/site-packages/networkx/algorithms/tests/test_covering.pytest_empty_graph	   s   z!TestMinEdgeCover.test_empty_graphc                 C   s,   t  }|dd t |dhksJ d S )Nr   r   r   )r   r   add_edger   r   r   r   r   test_graph_with_loop   s   z%TestMinEdgeCover.test_graph_with_loopc                 C   sR   t  }|d tjt jdd t | W d    d S 1 s"w   Y  d S )N   zFGraph has a node with no edge incident on it, so no edge cover exists.)match)r   r   add_nodepytestraisesNetworkXExceptionr   r   r   r   r   test_graph_with_isolated_v   s   
"z+TestMinEdgeCover.test_graph_with_isolated_vc                 C   s*   t dg}t |dhdhfv sJ d S )Nr   r   r   r   )r   r   r   r   r   r   r   test_graph_single_edge   s   z'TestMinEdgeCover.test_graph_single_edgec                 C   sT   t d}t |}t|dksJ |jD ]\}}||f|v s'||f|v s'J qd S )N      )r   
path_graphr   lenedges)r	   r
   	min_coveruvr   r   r   test_graph_two_edge_path   s   

z)TestMinEdgeCover.test_graph_two_edge_pathc                 C   s   t  }|jg ddd |jg ddd |g d t |t jjjj}t 	||s/J t
|dks7J t |}t 	||sDJ t
|dksLJ d S )	N)r   r   r      r   )	bipartite)abcr   ))r   r&   )r   r'   )r   r'   )r   r(   )r   r(   )r$   r&      r$   )r   r   add_nodes_fromadd_edges_fromr   
algorithmsr%   matchingeppstein_matchingis_edge_coverr   )r	   r
   r    
min_cover2r   r   r   test_bipartite_explicit&   s   
z(TestMinEdgeCover.test_bipartite_explicitc                 C   8   t d}t |}t ||sJ t|dksJ d S )N
      r   complete_graphr   r/   r   r	   r
   r    r   r   r   test_complete_graph_even6      

z)TestMinEdgeCover.test_complete_graph_evenc                 C   r2   )N      r5   r7   r   r   r   test_complete_graph_odd<   r9   z(TestMinEdgeCover.test_complete_graph_oddN)__name__
__module____qualname____doc__r   r   r   r   r#   r1   r8   r<   r   r   r   r   r      s    	r   c                   @   s(   e Zd ZdZdd Zdd Zdd ZdS )	TestIsEdgeCoverz3Tests for :func:`networkx.algorithms.is_edge_cover`c                 C   s   t  }t |t sJ d S r   )r   r   r/   r   r   r   r   r   r   F   s   z TestIsEdgeCover.test_empty_graphc                 C   s*   t  }|dd t |dhsJ d S )Nr   r   r   r   r   r   r/   r   r   r   r   r   J   s   z$TestIsEdgeCover.test_graph_with_loopc                 C   sd   t  }|dd t |ddhsJ t |ddhsJ t |dhs'J t |dhr0J d S )Nr   r   r   rB   r   r   rC   r   r   r   r   r   O   s   z&TestIsEdgeCover.test_graph_single_edgeN)r=   r>   r?   r@   r   r   r   r   r   r   r   rA   C   s
    rA   )r   networkxr   r   rA   r   r   r   r   <module>   s    =