o
    	h                     @   s   d dl Zd dlZd dlmZ d dlmZmZmZm	Z	 d dl
mZmZmZmZmZ dd Zdd Zd	d
 Zdd Zdd Zejdddgejdeegdd ZdS )    N)assert_array_almost_equal)	csr_array
csr_matrix	coo_array
coo_matrix)breadth_first_treedepth_first_treecsgraph_to_densecsgraph_from_densecsgraph_masked_from_densec                  C   s   t g dg dg dg dg dg} t| dd} t g dg dg d	g d
g d
g}dD ]}t| d|}tt|| q0d S )Nr         r   r   r   r   r   r      r   r   r      r   r   r   r   r   r   r   r   r   r   r   r   
null_valuer   r   r   r   r   )r   r   r   r   r   r   r   r   r   r   TFnparrayr
   r   r   r	   csgraphbfirstdirectedbfirst_test r"   ]/var/www/vscode/kcb/lib/python3.10/site-packages/scipy/sparse/csgraph/tests/test_traversal.pytest_graph_breadth_first	   s&   

r$   c                  C   s   t g dg dg dg dg dg} t| dd} t g dg d	g d
g dg dg}dD ]}t| d|}tt|| q0d S )Nr   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   dfirstr    dfirst_testr"   r"   r#   test_graph_depth_first   s"   

r(   c               	   C   sV  ddl m}  ddlm} tg dg dg dg dg dg}t|}t| |ts-J t||ts6J d	D ]}tt	|d
|tsEJ tt
|d
|tsPJ q8t|d
d}t|ts^J t| |tsgJ t||tspJ d	D ]}tt	|d
|tsJ tt
|d
|tsJ qrt|d
d}t|tjjsJ |jtju sJ t||tsJ d	D ]}tt	|d
|tsJ tt
|d
|tsJ qtj (}|td |td tg dg dg dg dg dg}W d    n1 sw   Y  t|}t| |ts	J t||tsJ d	D ]}tt	|d
|ts#J tt
|d
|ts/J qt|d
d}t|ts?J t| |tsIJ t||tsSJ d	D ]}tt	|d
|tscJ tt
|d
|tsoJ qUt|d
d}t|tjjsJ t||tsJ d	D ]}tt	|d
|tsJ tt
|d
|tsJ qd S )Nr   )	laplacian)minimum_spanning_treer   r   r   r   r   r   r   r   zthe matrix subclass.*)
_laplacianr)   _min_spanning_treer*   r   r   r   
isinstancer   r   r   r
   r   maMaskedArray
_baseclassndarraytestingsuppress_warningsfilterDeprecationWarningPendingDeprecationWarningmatrixr   r   )r)   r*   
np_csgraphr   r    sup
nm_csgraph
mm_csgraphr"   r"   r#   test_return_type0   st   


r<   c                  C   P   t dgg} t| dd} t dgg}dD ]}t| d|}tt|| qd S Nr   r   r   r   r   r"   r"   r#   &test_graph_breadth_first_trivial_graphu   s   r?   c                  C   r=   r>   r%   r   r"   r"   r#   $test_graph_depth_first_trivial_graph   s   r@   r    TF	tree_funcc                 C   sd   t dgtjdgdggtjdfdd}|jjtjksJ | |d|d}tt|ddgddgg d S )Nr   r   )dtype)r   r   )shape)r    )r   r   r   int64indicesrB   r   r	   )rA   r    gtreer"   r"   r#   test_int64_indices   s   &rH   )numpyr   pytestnumpy.testingr   scipy.sparser   r   r   r   scipy.sparse.csgraphr   r   r	   r
   r   r$   r(   r<   r?   r@   markparametrizerH   r"   r"   r"   r#   <module>   s    E