
    doiD                        S SK r S SKrS SKrS SKJr  S SKJrJrJ	r	J
r
  S SKJrJrJrJrJr  S rS rS rS rS	 r\R,                  R/                  S
SS/5      \R,                  R/                  S\\/5      S 5       5       rg)    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                     [         R                  " / SQ/ SQ/ SQ/ SQ/ SQ/5      n [        U SS9n [         R                  " / SQ/ SQ/ S	Q/ S
Q/ S
Q/5      nS H%  n[        U SU5      n[	        [        U5      U5        M'     g )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_tests       e/var/www/html/land-ocr/venv/lib/python3.13/site-packages/scipy/sparse/csgraph/tests/test_traversal.pytest_graph_breadth_firstr%   
   s    hh''''	) *G
 !Q7GXX&&&&	( )F "(!X>!"2;"?"(	* "    c                     [         R                  " / SQ/ SQ/ SQ/ SQ/ SQ/5      n [        U SS9n [         R                  " / SQ/ S	Q/ S
Q/ SQ/ SQ/5      nS H%  n[        U SU5      n[	        [        U5      U5        M'     g )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_tests       r$   test_graph_depth_firstr+      s|    hh''''	) *G
 !Q7GXX&&&&	( )F "&w8<!"2;"?H "r&   c            	      "	   SSK Jn   SSKJn  [        R
                  " / SQ/ SQ/ SQ/ SQ/ SQ/5      n[        U5      n[        U " U5      [        5      (       d   e[        U" U5      [        5      (       d   eS	 HG  n[        [        US
U5      [        5      (       d   e[        [        US
U5      [        5      (       a  MG   e   [        US
S9n[        U[        5      (       d   e[        U " U5      [        5      (       d   e[        U" U5      [        5      (       d   eS	 HG  n[        [        US
U5      [        5      (       d   e[        [        US
U5      [        5      (       a  MG   e   [        US
S9n[        U[        R                  R                  5      (       d   eUR                  [        R                   L d   e[        U" U5      [        5      (       d   eS	 HG  n[        [        US
U5      [        5      (       d   e[        [        US
U5      [        5      (       a  MG   e   ["        R$                  " 5          ["        R&                  " SS[(        5        ["        R&                  " SS[*        5        [        R,                  " / SQ/ SQ/ SQ/ SQ/ SQ/5      nS S S 5        [/        W5      n[        U " U5      [0        5      (       d   e[        U" U5      [.        5      (       d   eS	 HG  n[        [        US
U5      [.        5      (       d   e[        [        US
U5      [.        5      (       a  MG   e   [        US
S9n[        U[.        5      (       d   e[        U " U5      [0        5      (       d   e[        U" U5      [.        5      (       d   eS	 HG  n[        [        US
U5      [.        5      (       d   e[        [        US
U5      [.        5      (       a  MG   e   [        US
S9n[        U[        R                  R                  5      (       d   e[        U" U5      [.        5      (       d   eS	 HG  n[        [        US
U5      [.        5      (       d   e[        [        US
U5      [.        5      (       a  MG   e   g ! , (       d  f       GN= f)Nr   )	laplacian)minimum_spanning_treer   r   r   r   r   r   r   r   ignorezthe matrix subclass.*)
_laplacianr-   _min_spanning_treer.   r   r   r   
isinstancer   r	   r   r   r   maMaskedArray
_baseclassndarraywarningscatch_warningsfilterwarningsDeprecationWarningPendingDeprecationWarningmatrixr   r   )r-   r.   
np_csgraphr    r"   
nm_csgraph
mm_csgraphs          r$   test_return_typer@   1   s   &:?****	, -J
 
#Gi()4444+G4i@@@@!*7Ax@)LLLL,WaBINNNN " !:Ggy))))i()4444+G4i@@@@!*7Ax@)LLLL,WaBINNNN " (
qAGgruu001111++++G4i@@@@!*7Ax@)LLLL,WaBINNNN "
 
	 	 	"*ACUV-/H	J YY / / / /	 1 2
 
# $Gi(*5555+G4jAAAA!*7Ax@*MMMM,WaBJOOOO " !:Ggz****i(*5555+G4jAAAA!*7Ax@*MMMM,WaBJOOOO " +:!DJj"%%"3"34444+G4jAAAA!*7Ax@*MMMM,WaBJOOOO "= 
#	"s   ?AQ??
Rc                      [         R                  " S//5      n [        U SS9n [         R                  " S//5      nS H%  n[        U SU5      n[	        [        U5      U5        M'     g Nr   r   r   r   r   s       r$   &test_graph_breadth_first_trivial_graphrC   w   sX    hhuoG Q7GXXse_F!(!X>!"2;"?H "r&   c                      [         R                  " S//5      n [        U SS9n [         R                  " S//5      nS H%  n[        U SU5      n[	        [        U5      U5        M'     g rB   r(   r   s       r$   $test_graph_depth_first_trivial_graphrE      s[    hhuoG Q7GXXse_F!&w8<!"2;"?"(	* "r&   r"   TF	tree_funcc                    [        S/[        R                  " S/S//[        R                  S94SS9nUR                  R
                  [        R                  :X  d   eU " USUS9n[        [        U5      SS/SS//5        g )Nr   r   )dtype)r   r   )shape)r"   )r   r   r   int64indicesrH   r   r
   )rF   r"   gtrees       r$   test_int64_indicesrN      ss     	A31#s288<=VLA99??bhh&&&QH-D.t41v1v6FGr&   )r7   numpyr   pytestnumpy.testingr   scipy.sparser   r   r   r   scipy.sparse.csgraphr   r	   r
   r   r   r%   r+   r@   rC   rE   markparametrizerN    r&   r$   <module>rW      s       3 E EE E*(I&BPLI	* dE]3'9;K&LMH N 4Hr&   