
    |h                     $   d dl Zd dlmc mZ d dlmZmZmZ d dl	m
Z
 ej                  j                  d         ej                  dej                        Zd edddf<   d edddf<   dZd	 Zd
 Zd Zd Zd Z edddgdz        d        Zd Zy)    N)assert_array_equalassert_almost_equalparametrize)expected_warnings)   r   )dtype   z|\A\Zc                  :   t        dt        z   g      5  t        j                  t        d      } d d d         j                  dg      \  }}| j                  d      }t        |g dg dg dg d	g d
g dg dg dg       t        |g d       y # 1 sw Y   bxY w)NUpgrading NumPyTfully_connected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   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   warning_optionalmcpMCPa
find_costs	tracebackr   mcostsr/   return_paths       [/var/www/html/test/engine/venv/lib/python3.12/site-packages/skimage/graph/tests/test_mcp.py
test_basicr5      s    	-0@@A	B -GGAt,-||VH-E9++f%K44444444		
 	
%- -   BBc                     t        j                  t        dk(  t         j                  d      } g d}t        j                  t        dk(  dd      }t        j                  t        dk(  t         j                  d      }t	        dt
        z   g      5  t        j                  |d      }d d d        j                  dg      \  }}|j                  d	      }t        ||        t        ||       t	        dt
        z   g      5  t        j                  |d      }d d d        |j                  dg      \  }}|j                  d	      }t        ||        t        ||       y # 1 sw Y   xY w# 1 sw Y   TxY w)
Nr	   r   )
r   r   r   r!   r#   r$   r%   r&   r'   r(   r
   r   Tr   r   r(   )npwherer-   infr   r*   r+   r,   r.   r/   r   )expected_costsexpected_pathtest_negtest_infr1   r2   r/   r3   s           r4   test_neg_infr?   5   s1   XXa1fbffa0NM xxQA&HxxQ*H	-0@@A	B 4GGHd34||VH-E9++f%Kun-{M2	-0@@A	B 4GGHd34||VH-E9++f%Kun-{M24 44 4s   E?E*E'*E3c                      t        dt        z   g      5  t        j                  t        ddd      \  } }d d d        t        t        j                  d      dz         t         g d       y # 1 sw Y   :xY w)Nr   r   r   T)	geometricr   r   )	r   r*   r+   route_through_arrayr-   r   r8   sqrtr   )r3   costs     r4   
test_routerE   S   so    	-0@@A	B W33AvvQUVTWbggaj1n-	
W Ws   !A..A7c                  :   t        dt        z   g      5  t        j                  t        d      } d d d         j                  dg      \  }}| j                  d      }t        |g dg dg dg d	g d
g dg dg dg       t        |g d       y # 1 sw Y   bxY w)Nr   Fr   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   r   r   )r   r   r   r   r   r   r   g      @)r   r   r   r!   r#   )r	   r	   r$   r%   r&   r'   r(   )r   r	   r   r)   r0   s       r4   test_no_diagonalrG   i   s    	-0@@A	B .GGAu-.||VH-E9++f%K44444444		
 	
#. .r6   c                     t        d      D  cg c]  } d| f c} t        dd      D  cg c]  } d|  f	 c} z   }t        dt        z   g      5  t        j                  t
        |      }d d d        j                  dg      \  }}t        |g dg dg dg d	g d	g d	g d	g d	g       t        |d
      sJ t        ||j                         y c c} w c c} w # 1 sw Y   qxY w)N
   r	   r   )offsetsr   )rK   rK   rK   rK   rK   rK   rK   )rK   rK   rK   rK   rK   rK   r
   rK   )               rI   r   r	   )rI   r   r	   r   r"   r    r   r   rJ   )
ranger   r*   r+   r,   r-   r.   r   hasattrrJ   )irJ   r1   r2   r/   s        r4   test_offsetsrT      s    $Ry)!1v)eArl,Ka!W,KKG	-0@@A	B (GGAw'(||VH-E9,,*%%%%%		
 1i   w		*% *,K( (s   CCCC"shape)d   rV   )r   r   rN      r   c                     t        |        y )N)_test_random)rU   s    r4   test_crashingrZ      s
        c                    t        j                  j                  |  j                  t         j                        }dgt        |       z  dgt        |       z  t         j                  j                  t        |             | z  j                  t              g}t        d      D cg c]@  }t         j                  j                  t        |             | z  j                  t              B }}t        dt        z   g      5  t        j                  |d      }d d d        j                  |      \  }}t        d      D cg c]@  }t         j                  j                  t        |             | z  j                  t              B c}D ]  }|j                  |        |j                          |j                  ||       |D ]  }	|j                  |	        |||fS c c}w # 1 sw Y   xY wc c}w )Nr   r
   r    r   Tr   )r8   randomrandastypefloat32lenintrQ   r   r*   r+   r,   r.   r/   _reset)
rU   r-   startsrS   endsr1   r2   rJ   pointends
             r4   rY   rY      s   
		%%bjj1A	
c%j	s5z	E
	#e	+33C8F
 GLAhORYY^^CJ'%/77<ODO	-0@@A	B -GGAt,-\\&)NE7LQRSHUq299>>#e*-5==cBU 	EHHJLL 	CeW P- - Vs   "AG<G=AG+G()numpyr8   skimage.graph.mcpgraphr+   skimage._shared.testingr   r   r   skimage._shared._warningsr   r]   seedonesr`   r-   r*   r5   r?   rE   rG   rT   rZ   rY    r[   r4   <module>rp      s       X X 7 		q BGGF"**%!B$'
!QrT'
 "J3<,#L+, Wz>2Q67 8r[   