
    9i6                        S SK r S SKJr  S SKrS SKrS SKJrJrJrJ	r	J
r
JrJrJrJrJrJrJrJr  S SKJrJr  Sr1 SkrSSS	1 S
kSS/4SSSS.SSS.S/r\R2                  R5                  SS/ S/SS//5      \R2                  R5                  S\\\/5      S 5       5       rS rS r " S S5      rS rS  r S! r!S" r"S# r#S$ r$\R2                  R5                  S%\%S4\&S4\'S&4\(S445      S' 5       r)\R2                  R5                  S(S) \*" S	5       5       \+" / S*Q5      45      S+ 5       r,\R2                  R5                  S,/ S-Q5      \R2                  R5                  S.\RZ                  \R\                  \R^                  /5      \R2                  R5                  S/\R`                  \Rb                  /5      S0 5       5       5       r2\R2                  R5                  S,/ S-Q5      \R2                  R5                  S.\RZ                  \R\                  \R^                  /5      \R2                  R5                  S/\Rf                  \Rh                  /5      S1 5       5       5       r5\R2                  R5                  S,/ S-Q5      \R2                  R5                  S.\RZ                  \R\                  \R^                  /5      \R2                  R5                  S2/ S*Q5      S3 5       5       5       r6S4 r7S5 r8S6 r9S7 r:g)8    N)copy)PythonRandomInterfacePythonRandomViaNumpyBitsarbitrary_elementcreate_py_random_statecreate_random_statedict_to_numpy_arraydiscrete_sequenceedges_equalflattengroupsmake_list_of_intspairwisepowerlaw_sequence)_dict_to_numpy_array1_dict_to_numpy_array2)      )      ))      )   )   )	   
      )                           >   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   foobarbaz)r   r   )r   r   qweasd)r    r#   )r$   )r%   19r'   resultexisting	existing1	existing2nestedc                    Uc  [        X5      n[        U5      S:X  d   eOH[        U5      n[        U5      n[        X5      n[        U5      [        U5      s=:X  a
  SU-   :X  d   e   e[        [	        U5      [
        5      (       d   eg )Nr'   )r   lenr   
issubclasstypetuple)r6   r2   val_result	nexistings        ^/var/www/html/land-doc-ocr/venv/lib/python3.13/site-packages/networkx/utils/tests/test_misc.pytest_flattenr@   0   s{     ~f%3x2~~v,L	f&3x3w<92	>99999d3i''''    c                  D   / SQn [        U 5      U L d   e[        U 5      U :X  d   e[        [        U 5      S   [        5      (       d   e[        R                  " [
        R                  [         / SQ5        [        R                  " [
        R                  [         / SQ5        g )N)r   r   g      @*   r   )r   r   r   kermit)r   r   g@)r   
isinstanceintpytestraisesnxNetworkXError)mylists    r?   test_make_list_of_intsrM   ?   sz     FV$...V$...'/2C8888
MM"""$57JK
MM"""$5{CrA   c                  0    [        SSS9n [        S/ SQS9n g )Nr'   g      @)exponent)r   r   r   r   r   r   r   r   r   r   r   )distribution)r   r
   )zs    r?   test_random_number_distributionrR   H   s    "s+A"+LMArA   c                   B    \ rS rSr\S 5       rS rS rS rS r	S r
Srg	)
TestNumpyArrayN   c                 0    [         R                  " S5      qg )Nnumpy)rH   importorskipnp)clss    r?   setup_classTestNumpyArray.setup_classO   s       )rA   c                    [         R                  / SQ[         R                  S9n[         R                  / SQ5      n[         R                  / SQ5      n[        [	        U5      [
        5      (       d   e[	        U5      [        U5      :X  d   e[	        U5      n[        US   [        5      (       d   e[        R                  " [        R                  [        U5        g )Nr   r   r   )dtype)g      ?r   r   )g?r   r   r   )rY   arrayint64rF   r   listrG   rH   rI   rJ   rK   )selfabcBs        r?   test_numpy_to_list_of_ints)TestNumpyArray.test_numpy_to_list_of_intsT   s    HHYbhhH/HH[!HH[!+A.5555 #tAw...a !A$$$$$b&&(91=rA   c                    SSS.n[        USSS.S9n[        R                  R                  U[        R	                  SS/5      5        [        USSS.S9n[        R                  R                  U[        R	                  SS/5      5        [        U5      n[        R                  R                  UR                  5       S5        g )Nr   r   rd   re   r   mapping)re   rd   r   )r   rY   testingassert_allcloser`   sum)rc   drd   s      r?   test__dict_to_numpy_array1)TestNumpyArray.test__dict_to_numpy_array1^   s    !!!11-=>


""1bhh1v&67!!11-=>


""1bhh1v&67!!$


""1557A.rA   c                    SSS.SSS.S.nSSS.n[        XS9n[        R                  R                  U[        R	                  SS/SS//5      5        [        U5      n[        R                  R                  UR                  5       S5        g 	Nr   r   rk   r   r'   r   rl   !   )r   rY   rn   ro   r`   rp   rc   rq   rm   rd   s       r?   test__dict_to_numpy_array2)TestNumpyArray.test__dict_to_numpy_array2h   sx    "r);<"!!5


""1bhhR1a&/A&BC!!$


""1557B/rA   c                    SSS.SSS.S.nSSS.n[        XS9n[        R                  R                  U[        R	                  SS/SS//5      5        SSS.n[        XS9n[        R                  R                  U[        R	                  SS/SS//5      5        [        U5      n[        R                  R                  UR                  5       S5        g ru   )r	   rY   rn   ro   r`   r   rp   rw   s       r?   test_dict_to_numpy_array_a)TestNumpyArray.test_dict_to_numpy_array_ar   s    "r);<"3


""1bhhAR/A&BC"3


""1bhhR1a&/A&BC!!$


""1557B/rA   c                    SSS.nSSS.n[        XS9n[        R                  R                  U[        R	                  SS/5      5        [        U5      n[        R                  R                  UR                  5       S5        g )Nr   r   rk   r   rl   r   )r	   rY   rn   ro   r`   r   rp   rw   s       r?   test_dict_to_numpy_array_b)TestNumpyArray.test_dict_to_numpy_array_b   se    !"3


""1bhh1v&67!!$


""1557A.rA    N)__name__
__module____qualname____firstlineno__classmethodr[   rh   rr   rx   r{   r~   __static_attributes__r   rA   r?   rT   rT   N   s-    * *>/00/rA   rT   c                  l   [        S5      n / SQnUS/-   n[        [        U 5      5      U:X  d   e[        [        [        U 5      5      5      U:X  d   e[        [        U SS95      U:X  d   e[        S5      n[        [        U5      5      / :X  d   e[        S5      n[        [        USS95      / :X  d   eg )Nr   )r   r   r   r   )r   r   )r   r   T)cyclicr   )rangerb   r   iter)nodes
node_pairsnode_pairs_cycle
empty_iters       r?   test_pairwiser      s    !HE)J!VH, J...e%&*444t,-1AAAAbJ$%+++bJD12b888rA   c                      [        [        S/ SQ5      5      n [        U 5      nSS1SS1S1S.nX:X  d   e0 [        0 5      :X  d   eg )	Nabcde)r   r   r   r   r   rd   re   rf   rq   e)r   r   r   )dictzipr   )many_to_oneactualexpecteds      r?   test_groupsr      sQ    s7O45KK F:3*#7HrA   c                     [         R                  " S5      n U R                  R                  n[	        [        S5      U5      (       d   e[	        [        S 5      U5      (       d   e[	        [        U R                  5      U5      (       d   e[	        [        U" S5      5      U5      (       d   eU R                  R                  5       n[	        [        U5      U R                  R                  5      (       d   e[         R                  " [        [
        S5        U R                  U" S5      R                  S5      [        S5      R                  S5      :H  5      (       d   eg )NrW   r   rd   r   )rH   rX   randomRandomStaterF   r   default_rng	GeneratorrI   
ValueErrorallrand)rY   rsrngs      r?   test_create_random_stater      s
   			W	%B			B)!,b1111)$/4444)"))4b9999)"Q%0"5555
))


!C)#.		0C0CDDDD
MM*13766"Q%**R.$7$:$?$?$CCDDDDrA   c                  Z   [         R                  n [        [        S5      U 5      (       d   e[        [        S 5      U 5      (       d   e[        [        U " S5      5      U 5      (       d   e[        R
                  " [        [        S5        [        R                  " S5      nUR                   R                  nUR                   R                  S5      nUR                   R                  UR                   R                  5       5      n[        n[        n[        [        UR                   5      U5      (       d   e[        [        U" S5      5      U5      (       d   e[        [        U5      U5      (       d   e[        [        U5      U5      (       d   eU" 5       nU" 5       n[        Xu5      (       d   e[        X5      (       d   e[        U5      U:X  d   e[        U5      U:X  d   eSn	X2" S5      4 H8  n
[        U
5      nUR                  SU	S-   5        UR                  SU	S-   5        M:     g )Nr   rd   rW   i  l    r   r   )r   RandomrF   r   rH   rI   r   rX   r   r   r   SFC64r   r   	randrangerandint)pyrsrY   r   r   rng_explicitold_nprsnprsold_nprs_instancenprs_instanceint64maxrprss               r?   test_create_py_random_stater      s   ==D,Q/6666,T2D9999,T!W5t<<<<
MM*4c:			W	%B			B
))


%C99&&ryy'89L$H#D,RYY7>>>>,RU3X>>>>,S148888,\:DAAAA 
FM'2222m****!"348IIII!-0MAAA #H2a5\$Q'aA&Ax!|$ rA   c            
         [         R                  " S5      n SnU R                  R                  n[	        U" U5      5      nU" U5      nUR                  SS5      UR                  SS5      :X  d   eUR                  S5      UR                  SS5      :X  d   eUR                  SS5      UR                  SS5      :X  d   eUR                  / S	Q5      UR                  / S	Q5      :X  d   eUR                  SS5      UR                  SS5      :X  d   eUR                  S
5      UR                  S5      :X  d   eUR                  S5      UR                  S5      :X  d   eU R                  UR!                  / S	Q5      UR!                  / S	Q5      :H  5      (       d   eU R                  UR#                  / S	QS5      UR                  / S	QSSS9:H  5      (       d   eU R                  [%        S5       Vs/ s H  oSR                  SS5      PM     sn[%        S5       Vs/ s H  oTR                  SS5      PM     sn:H  5      (       d   eUR                  5       UR'                  5       :X  d   eg s  snf s  snf NrW   rC   r   r   r   r   r   r   r^   g      ?gUUUUUU?)r   F)replaced   r   )rH   rX   r   r   r   r   r   uniformchoicegaussnormalexpovariateexponentialparetovariateparetor   shufflesampler   random_sample)rY   seedr   r   rs42_s         r?   &test_PythonRandomInterface_RandomStater      s   			W	%BD			B
4
)Cd8D ==A$,,q!"4444==t||Aq1111;;q"a!4444::i DKK	$::::99Q?dkk!Q////??34#3#3G#<<<<Q4;;q>11166#++i(DLL,CCDDDD66

9a DKK	4K$OO    66$)#J/JqQ	J/(-c
3
1LLA
3	4    ::<4--//// 	03s   0I*I/
c            
         [         R                  " S5      n SnU R                  R                  U5      n[	        U R                  R                  U5      5      nUR                  SS5      UR                  SS5      :X  d   eUR                  S5      UR                  SS5      :X  d   eUR                  SS5      UR                  SS5      :X  d   eUR                  / S	Q5      UR                  / S	Q5      :X  d   eUR                  SS5      UR                  SS5      :X  d   eUR                  S
5      UR                  S5      :X  d   eUR                  S5      UR                  S5      :X  d   eU R                  UR!                  / S	Q5      UR!                  / S	Q5      :H  5      (       d   eU R                  UR#                  / S	QS5      UR                  / S	QSSS9:H  5      (       d   eU R                  [%        S5       Vs/ s H  oCR'                  SS5      PM     sn[%        S5       Vs/ s H  oBR                  SS5      PM     sn:H  5      (       d   eUR                  5       UR                  5       :X  d   eg s  snf s  snf r   )rH   rX   r   r   r   r   integersr   r   r   r   r   r   r   r   r   r   r   r   r   )rY   r   r   prir   s        r?   $test_PythonRandomInterface_Generatorr      s!   			W	%BD
))


%C
		 5 5d ;
<C ==A#,,q!"4444==s||Aq1111;;q"Q!3333::i CJJy$999999Q?cjjA....??33??7#;;;;Q3::a=00066#++i(CKK	,BBCCCC66

9a CJJy$J$NN    66$)#J/JqQ	J/(-c
3
1LLA
3	4    ::<3::<''' 	03s    I:*I?
)iterable_typer   [c                 :    U " / SQ5      n[        U5      U:X  d   eg )Nr^   )r   )r   r   iterables      r?   test_arbitrary_elementr     s!     Y'HX&(222rA   iteratorc              #   $   #    U  H  ov   M     g 7fNr   ).0is     r?   	<genexpr>r     s     Aas   r^   c                     [         R                  " [        SS9   [        U 5        SSS5        g! , (       d  f       g= f)z0Value error is raised when input is an iterator.zfrom an iterator)matchN)rH   rI   r   r   )r   s    r?   test_arbitrary_element_raisesr     s'     
z);	<(# 
=	<	<s   /
=n)r   r   r'   gencreate_usingc                    U" XS9nU" XS9n[        UR                  5       UR                  5       UR                  5       S9(       d   e[        UR                  5       UR                  5       UR                  5       S9(       d   eUR                  SS5        [        UR                  5       UR                  5       UR                  5       S9(       d   e[        UR                  5       UR                  5       UR                  5       S9(       a   e[        UR                  5       UR                  5       UR                  5       S9(       a   eg)zHTest whether edges_equal properly compares edges without attribute data.r   directedr   r   N)r   edgesis_directedremove_edge)r   r   r   GHs        r?   test_edges_equalr     s    
 	A)AA)Aqwwy!'')ammoFFFqwwy!'')ammoFFFMM!Qqwwy!'')ammoFFF1779aggi!--/JJJ1779aggi!--/JJJJrA   c                    U" XS9nU" XS9n[        UR                  5       5      nUR                  U5        UR                  U5        [        UR                  5       UR                  5       UR	                  5       S9(       d   eUR                  SS5        [        UR                  5       UR                  5       UR	                  5       S9(       d   e[        UR                  5       UR                  5       UR	                  5       S9(       a   eg)zDTest whether ``edges_equal`` properly compares edges in multigraphs.r   r   r   r   N)rb   r   add_edges_fromr   r   r   )r   r   r   r   r   G_edgess         r?   test_edges_equal_multiedger   *  s    
 	A)AA)A1779oGWWqwwy!'')ammoFFFMM!Qqwwy!'')ammoFFF1779aggi!--/JJJJrA   weightc                   ^ U" U 5      nU" U 5      n[        UR                  5       5      nUR                  U4S jU 5       5        [        UR                  5       UR                  5       5      (       d   eUR                  U4S jU 5       5        [        UR                  5       UR                  5       5      (       d   e[        UR                  SS9UR                  SS95      (       a   eg)zFTest whether ``edges_equal`` properly compares edges with weight data.c              3   2   >#    U  H  n/ UQTP7v   M     g 7fr   r   r   r   r   s     r?   r   ,test_edges_equal_weighted.<locals>.<genexpr>E  s     <Gqll6lGs   c              3   8   >#    U  H  n/ UQTS -   P7v   M     g7f)r   Nr   r   s     r?   r   r   H  s      @1..6A:.s   TdataN)rb   r   add_weighted_edges_fromr   )r   r   r   r   r   r   s     `   r?   test_edges_equal_weightedr   <  s    
 	AAAA1779oG<G<<qwwy!''),,,,@@@qwwy!''),,,,1777-qwwDw/ABBBBBrA   c                  J   [         R                  " S5      n [         R                  " S5      n[         R                  " S[         R                  S9nSSS.SS0S.n[         R                  " X5        [	        U R                  SS	9U R                  SS	95      (       d   e[	        U R                  SS	9U R                  5       5      (       a   e[         R                  " X5        [	        U R                  5       UR                  5       5      (       d   e[	        U R                  SS	9UR                  SS	95      (       d   eS
US   S   S'   [	        U R                  5       UR                  5       5      (       d   e[	        U R                  SS	9UR                  SS	95      (       a   eg)zQTest whether ``edges_equal`` properly compares edges with attribute dictionaries.r   r   r'   nothing)attr1attr2r   )r   r   Tr   	somethingr   r   N)rJ   
path_graph
MultiGraphset_edge_attributesr   r   )r   r   Iattrss       r?   test_edges_equal_datar   M  sS   
aA
aA
abmm4A!I6!ME1$qwwDw)1777+=>>>>1777-qwwy99991$qwwy!''),,,,qwwDw)1777+=>>>>"AaDGGqwwy!''),,,,1777-qwwDw/ABBBBBrA   c                     [         R                  " S[         R                  S9n [         R                  " S[         R                  S9nU R                  SSSSS9  U R                  SSSSS	9  UR                  SSSSS9  UR                  SSSSS	9  [	        U R                  S
S9U R                  S
S95      (       d   e[	        U R                  5       UR                  5       5      (       a   e[	        U R                  S
S9UR                  S
S95      (       a   e[	        U R                  S
S9UR                  S
S95      (       a   e[	        U R                  S
S
S9UR                  S
S
S95      (       a   eg)zdTest whether ``edges_equal`` properly compares edges with attribute dictionaries in ``MultiGraphs``.r   r   r   r   bluer   r   greenr   Tr   )keys)r  r   N)rJ   r   r   add_edger   r   r   r   s     r?    test_edges_equal_multigraph_datar  a  sE   
abmm4A
abmm4AJJq!QfJ%JJq!QgJ&JJq!QfJ%JJq!QgJ&qwwDw)1777+=>>>>1779aggi00001777-qwwDw/ABBBB1777-qwwDw/ABBBB177478!''tRV':WXXXXXrA   c                     [         R                  " S/5      n [         R                  " S/5      n[        U R                  5       UR                  5       SS9(       d   e[        U R                  5       UR                  5       SS9(       a   eg)z>Test whether ``edges_equal`` properly compares directed edges.r   )r   r   Fr   TN)rJ   DiGraphr   r   r  s     r?   test_edges_equal_directedr  q  sa    


F8A


F8Aqwwy!'')e<<<1779aggi$????rA   c                     [         R                  " 5       n [         R                  " 5       nU R                  SSSS9  UR                  SSSS9  [        U R	                  SS9U R	                  SS9SS9(       d   eUR                  SSS	S
9  [        U R	                  SS9UR	                  SS9SS9(       a   eU R                  SSS	S
9  [        U R	                  SS9UR	                  SS9SS9(       d   eU R                  SS5        U R                  SSS	S
9  [        U R	                  SS9UR	                  SS9SS9(       d   e[        U R	                  SS9UR	                  SS9SS9(       a   eg)zZTest whether ``edges_equal`` properly compares directed edges with attribute dictionaries.r   r   r  r  Tr   r   r   r  r  FN)rJ   r
  r  r   r   r   r  s     r?   test_edges_equal_directed_datar  z  sK   


A


AJJq!6J"JJq!6J"qwwDw)1777+=MMMJJq!7J#1777-qwwDw/ADQQQJJq!7J#qwwDw)1777+=MMMMM!QJJq!7J#qwwDw)1777+=NNN1777-qwwDw/ADQQQQrA   );r   r   rH   networkxrJ   networkx.utilsr   r   r   r   r   r	   r
   r   r   r   r   r   r   networkx.utils.miscr   r   nested_depth
nested_setnested_mixedmarkparametrizer@   rM   rR   rT   r   r   r   r   r   r   rb   r;   strsetr   r   r   r   complete_graphr   cycle_graphGraphr
  r   r   MultiDiGraphr   r   r   r  r  r  r   rA   r?   <module>r     s          M
 >Aq6"	EU+%  D"zl[+<V#WXL,
#KL
( M Y
(DN:/ :/z
9E  %F06(4 !T1IqzC:Qx#P33
 qDO,$	$ k*!2!2BMM2>> RS"((BJJ)?@
K A T +
K k*!2!2BMM2>> RS"--)IJK K T +K k*!2!2BMM2>> RS9-C . T +CC(Y @RrA   