+
    )i(                         ^ RI t ^ RIt^ RIHt ] P
                  ! R4      t] P
                  ! R4      t ! R R4      t] P                  P                  RR	4      R 4       tR# )
    N)graphs_equalnumpyscipyc                      a  ] tR t^
t o R tR tR tR tR tR t	R t
R tR	 tR
 tR tR tR tR tR tR tR tR tR tR tRtV tR# )TestConvertScipyc                8   \         P                  ! ^
^4      V n        \         P                  ! ^
\         P                  R7      V n        V P                  \         P                  ! 4       4      V n        V P                  \         P                  ! 4       4      V n	        R# )
   create_usingN)
nxbarbell_graphG1cycle_graphDiGraphG2create_weightedGraphG3G4selfs   &_/var/www/html/photoedit/myenv/lib/python3.14/site-packages/networkx/tests/test_convert_scipy.pysetup_methodTestConvertScipy.setup_method   s\    ""2q).."**=&&rxxz2&&rzz|4    c                     ! R  R4      p\         P                  ! \        P                  \        P                  V4       R# )c                       ] tR t^tRtRtR# )+TestConvertScipy.test_exceptions.<locals>.GN )__name__
__module____qualname____firstlineno__format__static_attributes__r   r   r   Gr      s    Fr   r&   N)pytestraisesr   NetworkXErrorto_networkx_graph)r   r&   s   & r   test_exceptions TestConvertScipy.test_exceptions   s*    	 	 	b&&(<(<a@r   c                B   \         P                  ! ^4      p\        VP                  4       4      pV UUu. uF  w  rEVNK	  	  pppV UUu. uF  w  rEVNK	  	  pppV Uu. uF  q^
,           NK  	  p	p\	        WgV	4      p
VP                  V
4       V# u uppi u uppi u upi )   )r   r   listedgeszipadd_weighted_edges_from)r   r&   geuvsourcedestsweightexs   &&         r   r    TestConvertScipy.create_weighted   s    NN1O !"!" adaa "()&Qb&&&)v&	!!"% # )s   B
BBc                   \         P                  ! W#R 7      p\         P                  ! W4      '       g   Q h\         P                  ! W#R 7      p\         P                  ! W4      '       g   Q h\         P                  ! ^ V4      P                  V4      p\         P                  ! W4      '       g   Q hVP                  4       p\         P                  ! ^ V4      P                  V4      p\         P                  ! W4      '       g   Q hVP                  4       p\         P                  ! ^ V4      P                  V4      p\         P                  ! W4      '       g   Q hVP                  4       p	\         P                  ! ^ V4      P                  V	4      p\         P                  ! W4      '       g   Q hVP                  4       p
\         P                  ! ^ V4      P                  V
4      p\         P                  ! W4      '       g   Q hVP                  4       p\         P                  ! ^ V4      P                  V4      p\         P                  ! W4      '       g   Q hR# )r
   N)r   from_scipy_sparse_arrayis_isomorphicr*   empty_graph	__class__tocsrtocootocsctodensetoarray)r   r&   Ar   GGGWGIACSRACOOACSCADAAs   &&&&        r   identity_conversion$TestConvertScipy.identity_conversion"   s   ''E&&&&!!!?&&&&^^A|,66q9&&&&wwy^^A|,66t<&&&&wwy^^A|,66t<&&&&wwy^^A|,66t<&&&&YY[^^A|,66r:&&&&YY[^^A|,66r:&&&&r   c                    \         P                  P                  . RO. RO.4      p\        P                  ! \
        P                  \
        P                  V4       R# )z(Conversion from non-square sparse array.N)         )r.         )spsparse	lil_arrayr'   r(   r   r)   r>   r   rG   s   & r   
test_shapeTestConvertScipy.test_shape@   s7    III 67b&&(B(BAFr   c                    \         P                  ! V P                  4      pV P                  V P                  V\         P                  ! 4       4       R# )z0Conversion from graph to sparse matrix to graph.N)r   to_scipy_sparse_arrayr   rP   r   r[   s   & r   test_identity_graph_matrix+TestConvertScipy.test_identity_graph_matrixE   2    $$TWW-  !RXXZ8r   c                    \         P                  ! V P                  4      pV P                  V P                  V\         P                  ! 4       4       R# )z4Conversion from digraph to sparse matrix to digraph.N)r   r_   r   rP   r   r[   s   & r   test_identity_digraph_matrix-TestConvertScipy.test_identity_digraph_matrixJ   2    $$TWW-  !RZZ\:r   c                    \         P                  ! V P                  4      pV P                  V P                  V\         P                  ! 4       4       R# )zBConversion from weighted graph to sparse matrix to weighted graph.N)r   r_   r   rP   r   r[   s   & r   #test_identity_weighted_graph_matrix4TestConvertScipy.test_identity_weighted_graph_matrixO   rb   r   c                    \         P                  ! V P                  4      pV P                  V P                  V\         P                  ! 4       4       R# )zFConversion from weighted digraph to sparse matrix to weighted digraph.N)r   r_   r   rP   r   r[   s   & r   %test_identity_weighted_digraph_matrix6TestConvertScipy.test_identity_weighted_digraph_matrixT   rf   r   c                   \         P                  ! ^4      p\         P                  ! ^4      p\        VP                  4       4      p\         P                  ! WR7      p\         P
                  ! V4      p\         P                  ! WR4      '       g   Q h\        P                  ! \         P                  \         P                  V. R7       V^ .,           p\        P                  ! \         P                  \         P                  W&R7       . ROp\        P                  ! \         P                  \         P                  W'R7       R# )z>Conversion from graph to sparse matrix to graph with nodelist.nodelistN)r   rS   rT   )
r   
path_graphr/   nodesr_   r   r?   r'   r(   r)   )r   P4P3ro   rG   GAlong_nlnon_nls   &       r   test_nodelistTestConvertScipy.test_nodelistY   s    ]]1]]1
#$$R;XXa[''''b&&(@(@"rRaS.b&&(@(@"W b&&(@(@"Vr   c                   \         P                  ! 4       pVP                  R  \        ^4       4       4       \         P                  ! ^4      p\         P
                  ! V4      p\        P                  P                  VP                  4       \         P
                  ! VRR7      P                  4       4       \        P                  P                  RVP                  4       ,          \         P
                  ! V4      P                  4       4       \        P                  P                  RVP                  4       ,          \         P
                  ! VRR7      P                  4       4       R# )c              3   @   "   T F  qV^,           RRRR/3x  K  	  R# 5irS   r:         ?other333333?Nr   .0ns   & r   	<genexpr>7TestConvertScipy.test_weight_keyword.<locals>.<genexpr>m   "     Whq1uxgs&CDh   Nr:   r}   r   r~   
r   r   add_edges_fromrangerq   r_   nptestingassert_equalrE   r   WP4rs   rG   s   &   r   test_weight_keyword$TestConvertScipy.test_weight_keywordk   s    hhjWeTUhWW]]1$$R(


IIK11#dCKKM	
 	

!))+r77<DDF	
 	

!))+r77GLTTV	
r   c                j   \         P                  ! 4       pVP                  R  \        ^4       4       4       \         P                  ! ^4      p\         P
                  ! VRR7      p\        P                  P                  VP                  4       \         P
                  ! VRR7      P                  4       4       \         P
                  ! VRR7      p\        P                  P                  VP                  4       \         P
                  ! VRR7      P                  4       4       \         P
                  ! VRR7      p\        P                  P                  VP                  4       \         P
                  ! VRR7      P                  4       4       \         P
                  ! VRR7      p\        P                  P                  VP                  4       \         P
                  ! VRR7      P                  4       4       \         P
                  ! VRR7      p\        P                  P                  VP                  4       \         P
                  ! VRR7      P                  4       4       \         P
                  ! VR	R7      p\        P                  P                  VP                  4       \         P
                  ! VRR7      P                  4       4       \         P
                  ! VR
R7      p\        P                  P                  VP                  4       \         P
                  ! VRR7      P                  4       4       R# )c              3   @   "   T F  qV^,           RRRR/3x  K  	  R# 5ir|   r   r   s   & r   r   7TestConvertScipy.test_format_keyword.<locals>.<genexpr>|   r   r   csrr$   Nr   csccoobsrlildiadokr   r   s   &   r   test_format_keyword$TestConvertScipy.test_format_keywordz   s#   hhjWeTUhWW]]1$$R6


IIK11#dCKKM	
 $$R6


IIK11#dCKKM	
 $$R6


IIK11#dCKKM	
 $$R6


IIK11#dCKKM	
 $$R6


IIK11#dCKKM	
 $$R6


IIK11#dCKKM	
 $$R6


IIK11#dCKKM	
r   c                `   \         P                  ! \        P                  4      ;_uu_ 4        \        P                  ! 4       pVP                  R  \        ^4       4       4       \        P                  ! ^4      p\        P                  ! VRR7       RRR4       R#   + '       g   i     R# ; i)c              3   @   "   T F  qV^,           RRRR/3x  K  	  R# 5ir|   r   r   s   & r   r   =TestConvertScipy.test_format_keyword_raise.<locals>.<genexpr>   s%      CKaAEHc7C898r   	any_otherr   N)	r'   r(   r   r)   r   r   r   rq   r_   )r   r   rs   s   &  r   test_format_keyword_raise*TestConvertScipy.test_format_keyword_raise   sp    ]]2++,,((*C CH8  q!B$$R< -,,,s   A%BB-	c                    \         P                  ! \        P                  4      ;_uu_ 4        \        P                  ! \        P
                  ! 4       4       R R R 4       R #   + '       g   i     R # ; i)N)r'   r(   r   r)   r_   r   r   s   &r   test_null_raise TestConvertScipy.test_null_raise   s:    ]]2++,,$$RXXZ0 -,,,s   *A!!A2	c                   \         P                  ! 4       pVP                  ^4       \         P                  ! V4      p\        P
                  P                  VP                  4       \        P                  ^ ..4      4       R# )rS   N)	r   r   add_noder_   r   r   r   rF   arrayr   r&   Ms   &  r   
test_emptyTestConvertScipy.test_empty   sN    HHJ	

1$$Q'


		RXXse_=r   c           	     d   \         P                  ! 4       pVP                  ^^4       VP                  ^^4       VP                  ^^4       \         P                  ! V. ROR7      p\        P
                  P                  VP                  4       \        P                  . RO. RO. RO.4      4       R# )rS   rn   N)rU   rT   rS   r   r   rS   )rS   r   r   r   rS   r   )	r   r   add_edger_   r   r   r   rF   r   r   s   &  r   test_orderingTestConvertScipy.test_ordering   sv    JJL	

1a	

1a	

1a$$Q;


IIK9i"CD	
r   c           	        \         P                  ! R.4      p\         P                  ! V4      p\        P                  P                  VP                  4       \        P                  ^..4      4       VP                  RR.4       \         P                  ! V. ROR7      p\        P                  P                  VP                  4       \        P                  . RO. RO. RO.4      4       R# )	rS   rn   NrS   rS   rT   rU   rU   r.   rT   rU   r.   r   )rS   r   rS   )	r   r   r_   r   r   r   rF   r   r   r   s   &  r   test_selfloop_graph$TestConvertScipy.test_selfloop_graph   s    HHfX$$Q'


		RXXse_=	&&)*$$Q;


IIK9i"CD	
r   c           	        \         P                  ! R.4      p\         P                  ! V4      p\        P                  P                  VP                  4       \        P                  ^..4      4       VP                  RR.4       \         P                  ! V. ROR7      p\        P                  P                  VP                  4       \        P                  . RO. RO. R	O.4      4       R# )
rS   rn   Nr   r   r   r   r   r   )r   r   r   )	r   r   r_   r   r   r   rF   r   r   r   s   &  r   test_selfloop_digraph&TestConvertScipy.test_selfloop_digraph   s    JJx $$Q'


		RXXse_=	&&)*$$Q;


IIK9i"CD	
r   c           	        \         P                  P                  ^^.^^..4      p\        P                  ! 4       p. ROpTP                  V UUu. uF	  w  rEWE^3NK  	  upp4       VP                  ^^^R7       \        P                  ! VR\        P                  R7      p\        Wb4      '       g   Q h\        P                  ! VR\        P                  R7      p\        Wb4      '       g   Q h. ROp\        P                  ! 4       pTP                  V UUu. uF	  w  rEWE^3NK  	  upp4       \        P                  ! VR\        P                  R7      p\        Wb4      '       g   Q h\        P                  ! 4       pVP                  \        V4      ^R7       ^V^,          ^,          ^ ,          R&   \        P                  ! VR\        P                  R7      p\        Wb4      '       g   Q hR# u uppi u uppi )	zTests that the :func:`networkx.from_scipy_sparse_array` function
interprets integer weights as the number of parallel edges when
creating a multigraph.

r   T)parallel_edgesr   Fr:   N)r   r   r   rS   rS   r   )r   r   r   r   r   )rX   rY   	csr_arrayr   r   r2   r   r>   r   MultiDiGraphr   set)r   rG   expectedr0   r5   r6   actuals   &      r   +test_from_scipy_sparse_array_parallel_edges<TestConvertScipy.test_from_scipy_sparse_array_parallel_edges   s    II!Q!Q 01 ::<(((%)H%1)%)HI!Qq)++d
 F----++e"**
 F---- 9??$((%)H%1)%)HI++d
 F----??$E
15&'Aq(#++e"//
 F----7 *I *Is   G/
G5
c                   \         P                  P                  ^ ^.^^ ..4      p\        P                  ! V\        P
                  R7      p\        P
                  ! 4       pVP                  ^ ^^R7       \        W#4      '       g   Q hR# )zTests that a symmetric matrix has edges added only once to an
undirected multigraph when using
:func:`networkx.from_scipy_sparse_array`.

r
   r   N)rX   rY   r   r   r>   
MultiGraphr   r   )r   rG   r&   r   s   &   r   test_symmetricTestConvertScipy.test_symmetric   sl     II!Q!Q 01&&qr}}E==?!Qq)A((((r   )r   r   r   r   N)r    r!   r"   r#   r   r+   r   rP   r\   r`   rd   rh   rk   rx   r   r   r   r   r   r   r   r   r   r   r%   __classdictcell__)__classdict__s   @r   r   r   
   ss     5A'<G
9
;
9
;
W$
%
N=1>
	
	
&.P
) 
)r   r   sparse_formatc                X   \         P                  ! 4       pVP                  ^ ^R^/3^ ^R^/3^^ R^/3^^R^/3^^ R^/3^^R^/3.4       \        P                  P                  . RO. RO. RO.4      P                  V 4      p\        V\         P                  ! V4      4      '       g   Q hR# )z7Test all formats supported by _generate_weighted_edges.r:   N)r   rU   rT   )rU   r   rS   )rT   rS   r   )	r   r   r   rX   rY   	coo_arrayasformatr   r>   )r   r   rG   s   &  r   $test_from_scipy_sparse_array_formatsr   	  s     xxzHHa=!Ha=!Ha=!Ha=!Ha=!Ha=!	
	 			Y	9=>GGVA""<"<Q"?@@@@r   )r   r   r   )r'   networkxr   networkx.utilsr   importorskipr   rX   r   markparametrizer   r   r   r   <module>r      sd      '!!|) |)~ *?@A AAr   