
    -ig                        S SK r S SKrS SKJr  S SKJs  Jr  S SK	J
r
  S SKJr   S SKr\ R                  R                  \SL SS9rSr\ R$                  " S5      \ R$                  " S\ R                  R'                  \S9/S	94rS
 r\ R,                  " \S9S 5       r\ R,                  S 5       r\ R                  R3                  S\R4                  \R6                  \R8                  \R:                  \R<                  \R>                  \R@                  \RB                  /5      S 5       r"S r#S r$\ R                  R3                  S\RJ                  \RL                  /5      S 5       r'\ R                  R3                  S\RP                  \RR                  /5      S 5       r*S r+S r,S r-\" S5      \ R                  R3                  S\R4                  \R6                  \R8                  \R:                  \R<                  \R\                  /5      \ R                  R3                  S\R^                  \R`                  4\Rb                  \Rd                  4/5      S 5       5       5       r3g! \ a    Sr GNEf = f)    N)_pep440)assert_equalzpydata/sparse not installedreasonz>pydata/sparse (0.15.1) does not implement necessary operationsCOODOK)marksc                     [         c  [        R                  R                  SS9$ [        R                  R	                  [
        R                  " [         R                  5      [
        R                  " U 5      :  SU  S3S9$ )Nzsparse is not installedr   zsparse version >= z	 required)	sparsepytestmarkskipskipifr   parse__version__Version)min_vers    `/var/www/html/venv/lib/python3.13/site-packages/scipy/sparse/csgraph/tests/test_pydata_sparse.pycheck_sparse_versionr      sh    ~{{'@AA;;f(()GOOG,DD#G9I6       )paramsc                 6    [        [        U R                  5      $ N)getattrr   param)requests    r   
sparse_clsr   #   s    67==))r   c                 f    / SQ/ SQ/ SQ/ SQ/ SQ/n[         R                  " U5      nU " U5      nX#4$ )N)r      r   r   r   )r   r   r   r   r   )r   r   r   r   r   )r   r   r   r   r   )nparray)r   graphA_denseA_sparses       r   graphsr%   (   s<     	E hhuoG'"Hr   funcc                 j    Uu  p#U " U5      nU " [         R                  " U5      5      n[        XE5        g r   sp	csc_arrayr   )r&   r%   r#   r$   actualdesireds         r   test_csgraph_equivr-   6   s0     G(^F2<<()G!r   c                     U u  p[         R                  nU" U5      u  pEU" [        R                  " U5      5      u  pgXF:X  d   e[	        XW5        g r   )spgraphconnected_componentsr)   r*   r   )r%   r#   r$   r&   actual_compactual_labelsdesired_compdesired_labelss           r   test_connected_componentsr5   J   sK    G''D!%hK$(g)>$?!L&&&/r   c                     U u  p[        U5      n[        R                  nU" U5      nU" [        R                  " U5      5      n[        XS5      (       d   e[        UR                  5       UR                  5       5        g r   )typer/   	laplacianr)   r*   
isinstancer   todenser%   r#   r$   r   r&   r+   r,   s          r   test_laplacianr<   U   sc    GhJD(^F2<<()Gf))))!7??#45r   c                 n    U u  p#U" US5      nU" [         R                  " U5      S5      n[        XE5        g Nr   r(   )r%   r&   r#   r$   r+   r,   s         r   test_order_searchr?   b   s5     G(AF2<<(!,G!r   c                     U u  p#[        U5      nU" US5      nU" [        R                  " U5      S5      n[        XT5      (       d   e[	        UR                  5       UR                  5       5        g r>   )r7   r)   r*   r9   r   r:   )r%   r&   r#   r$   r   r+   r,   s          r   test_tree_searchrA   n   s_     GhJ(AF2<<(!,Gf))))!7??#45r   c                     U u  p[        U5      n[        R                  nU" U5      nU" [        R                  " U5      5      n[        XS5      (       d   e[        UR                  5       UR                  5       5        g r   )r7   r/   minimum_spanning_treer)   r*   r9   r   r:   r;   s          r   test_minimum_spanning_treerD   }   sc    GhJ((D(^F2<<()Gf))))!7??#45r   c                 |   U u  p[        U5      n[        R                  nU" USS5      nU" [        R                  " U5      SS5      nUR
                  UR
                  :X  d   e[        UR                  U5      (       d   e[        UR                  R                  5       UR                  R                  5       5        g )Nr      )
r7   r/   maximum_flowr)   	csr_array
flow_valuer9   flowr   r:   r;   s          r   test_maximum_flowrK      s    GhJD(Aq!F2<<(!Q/G 2 2222fkk:....$$&(<(<(>?r   c                    U u  p[         R                  nU" USS2SS24   5      n[        R                  " U5      nU" USS2SS24   5      nU" USS2SS24   R	                  5       5      n[        XF5        [        XG5        g )Nr   rF   r      )r/   "min_weight_full_bipartite_matchingr)   r*   tocoor   )r%   r#   r$   r&   r+   A_cscr,   desired1s           r   'test_min_weight_full_bipartite_matchingrR      s    G55D(1Q3!8$%FLL!E51ac?#GE!A#qs(O))+,H!"r   z0.15.4zfill_value, comp_funcc                    U u  pEUR                  [        5      nX%l        [        U5      nU" U5      nU" [        R
                  " U5      5      nU[        R                  :X  a_  [        Xv5      (       d   eU" UR                  5      (       d   eUR                  5       nSXs" U5      '   [        XxR                  5       5        g [        Xx5        g )Ng        )astypefloat
fill_valuer7   r)   r*   r/   rC   r9   r:   r   )	r%   r&   rV   	comp_funcr#   r$   r   r+   r,   s	            r   test_nonzero_fill_valuerX      s    " Gu%H$hJ(^F2<<()Gw,,,&----**++++!$'y !V__./V%r   )4r   numpyr    scipy.sparser   r)   scipy.sparse.csgraphcsgraphr/   
scipy._libr   numpy.testingr   	Exceptionr   r   
pytestmarkmsgr   xfailsparse_paramsr   fixturer   r%   parametrizeshortest_pathdijkstrafloyd_warshallbellman_fordjohnsonreverse_cuthill_mckeemaximum_bipartite_matchingstructural_rankr-   r5   r<   breadth_first_orderdepth_first_orderr?   breadth_first_treedepth_first_treerA   rD   rK   rR   rC   infisposinfnanisnanrX    r   r   <module>rw      s      & &  & [[$'D   F
 G e$eFKK,=,=S,=,I+JKM }%* &* 
 
 
%%**	""0
6 
W(('*C*CD"" 
W'')A)AB	6	6
6@
# h
%%
 ffbkkRVVRXX./&	
   &S  Fs   I# #I/.I/