
    wg!                     P   d dl Z  e j                  d      Zd dlZd dlZd dlmZ d dlm	Z	 d a
ej                  j                  d       ej                  j                         Z ej                  d        ej                         Zd Zd Ze j"                  j$                  d        Zy)	    Nnumpy)approximation)	threshold*   c                 B   t         dz  a t        t         dd        | |i | t        j                  j	                         }t
        |k(  sJ t        j                  j                  d       t        j                         }t        |k(  sJ t        j                  d       y)z1call one function and check if global RNG changed   , )endr   N)progressprintnprandomrandnp_rvseedpy_rv)fargskwdsafter_np_rvafter_py_rvs        m/home/mcse/projects/flask/flask-venv/lib/python3.12/site-packages/networkx/tests/test_all_random_functions.pytr      s|     MH	(CR tt)).."K KIINN2--/K K
KKO    c                     d}d}dx}}dx}}dx}x}x}	x}
x}}dx}x}}d}g d}t        j                  dd      }t        j                  d	      }|j                  d
 |j                  D               g d}|x}x}x}x}}t        t         j                  |        t        t         j                  | d       t        t         j                  |        t        t         j                  |        t        t         j                  |dd        t        t         j                  |dd        t        t         j                  |        t        t         j                  t        j                  d              t        t         j                  |        t        t         j                   |        t        t         j"                  |        t        t         j$                  |        t        t         j&                  |        t        t(        j*                  |        t        t(        j,                  |dd        t        t(        j.                  |dd        t        t(        j0                  | fd       t        t(        j0                  | fd       t        t         j2                  |        t        t         j4                  |        t        t         j6                  |        t        t         j8                  j:                  j<                  |        t        t         j8                  j>                  j@                  |        t        t         jB                  ||        t        t         j8                  j:                  jD                  ||d        t        t         j8                  jF                  jH                  jJ                  ||        t        t         j8                  jL                  jN                  ||        g d}t        tP        jR                  |        t        t         jT                  |        t        t         jV                  ||        t        t         jX                  |        t        t         jZ                  |        ddidddddddddddd}t        t         j\                  |        g d}t        t         j^                  |        ddg}t        t         j`                  |        t        t         jb                  |je                                 dddd}t        t         jf                  jh                  ||        t        t         jf                  jj                  |        t        t         j8                  jl                  jT                  ||        t        t         j8                  jl                  jn                  ||        d  }t        t         jp                  ||        g d!}g d"g d#g d$g} t        t         jr                  ||         t        t         jt                  |||        t        tP        jv                  ||        t        t         jx                  jz                  |        t        t         j|                  |||        t        t         j~                  ||||        t        t         j                  |||||        t        t         j                  |        t        t         j                  ||        t        t         j                  |        t        t         j                  |        t        t         j                  j                  ||        t        t         j                  |||        d%}!t        t         j                  |!|||        t        t         j                  ||        t        t         j                  ||        t        t         j                  ||        t        t         j                  ||        t        t         j                  |        t        t         j                  |        t        t         j                  |||        t        t         j                  |||        t        t         j                  |||        t        t         j                  |dd&d'g        t        t         j                  ||        t        t         j                  ||        t        t         j                  ||        t        t         j                  ||        t        t         j                  |||        t        t         j                  |||        t        t         j                  |||        t        t         j                  d	|        t        t         j                  ||        t        t         j                  ||||        t        t         j                  |||        t        t         j                  ||	|
        t        t         j                  | d()       t        t         j                  d d()       t        t         j                  |        t        t         jf                  j                  |        t        t         jf                  j                  d*        g d+}"t        t         jf                  j                  ||" ,       t        t         j8                  jl                  j                  |||        t        t         j8                  jl                  j                  |||        t         j                  j                  }#t        |#d-d	d.d&d	d d/	       t        t         j                  |        y )0N   
      皙?g      ?)r   r   r   )r   r         r!   c              3   ,   K   | ]  \  }}||d f  yw)皙?N ).0uvs      r   	<genexpr>z+run_all_random_functions.<locals>.<genexpr>3   s     >daq!Sk>s   )r!   r   r   r!   r   r   r!   r   r   r   r   r   r   r   F)r   
normalizedr   	   greedy)sourcer   c                 6    t        j                  | d|      S Nr-   r*   )approxsimulated_annealing_tspGweightr   s     r   <lambda>z*run_all_random_functions.<locals>.<lambda>O       !?!?xd"
 r   )methodc                 6    t        j                  | d|      S r0   )r1   threshold_accepting_tspr3   s     r   r6   z*run_all_random_functions.<locals>.<lambda>V   r7   r   )max_iterr   )dir=   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   ffffff?g333333?c                     ||z
  S )Nr%   )r'   wzs      r   kernel_integralz1run_all_random_functions.<locals>.kernel_integral   s    1ur   )K   rG   i,  )g      ?皙?{Gz?)rH   gffffff?Q?)rI   rJ   r    i  g?rA   i  )r   triesgffffff@)r$   r    rA   rB   g?g      ?)cdistributionr      g      ?)average_degreemin_communityr   max_community)jnxbarbell_graphcycle_graphadd_weighted_edges_fromedgesr   maximal_independent_setrich_club_coefficientrandom_referencelattice_referencesigmaomegadouble_edge_swapconnected_double_edge_swapcomplete_graphrandom_layoutfruchterman_reingold_layoutalgebraic_connectivityfiedler_vectorspectral_orderingr1   average_clusteringr2   r:   traveling_salesman_problembetweenness_centralityedge_betweenness_centrality/approximate_current_flow_betweenness_centrality
algorithms	communitykernighan_lin_bisectiontreegreedy_branchingspectral_graph_forgeasyn_fluidcconnectivityedge_augmentationgreedy_k_edge_augmentationcoloringstrategy_random_sequentialr   swap_dconfiguration_modeldirected_configuration_modelexpected_degree_graphrandom_degree_sequence_graphjoint_degree_graphrandom_clustered_graphrandom_shell_graphrandom_triadto_directedutilsrandom_weighted_sampleweighted_choice	bipartitepreferential_attachment_graphrandom_kernel_graphstochastic_block_modelrandom_partition_graphrandom_threshold_sequence
tournamentrandom_tournamentrelaxed_caveman_graphplanted_partition_graphgaussian_random_partition_graphgn_graph	gnr_graph	gnc_graphscale_free_graphdirectedrandom_uniform_k_out_graphrandom_k_out_graphpartial_duplication_graphduplication_divergence_graphrandom_geometric_graphsoft_random_geometric_graphgeographical_threshold_graphwaxman_graphnavigable_small_world_graph"thresholded_random_geometric_graph!uniform_random_intersection_graphk_random_intersection_graph!general_random_intersection_graphfast_gnp_random_graphgnp_random_graphdense_gnm_random_graphgnm_random_graphnewman_watts_strogatz_graphwatts_strogatz_graphconnected_watts_strogatz_graphrandom_regular_graphbarabasi_albert_graphextended_barabasi_albert_graphpowerlaw_cluster_graphrandom_lobsterrandom_powerlaw_treerandom_powerlaw_tree_sequencerandom_labeled_treepowerlaw_sequencezipf_rvdiscrete_sequencerandom_graphgnmk_random_graph
generatorsLFR_benchmark_graphrandom_internet_as_graph)$r   nmklsr(   pqp1p2p_inp_outalpharadiusthetasizescolorsr4   Hdeg_sequencein_degree_sequencerD   sequenceaseqbseqcsjoint_degreesjoint_degree_sequenceconstructormappingrF   probsNcdistLFRs$   `                                   r   run_all_random_functionsr   (   s   
A
AIAJA%((A((B((dU!!E!FUEF
R A
qA>agg>>:L6BBBBXBt b  !$/b?b14(bAD)bhh1ad#bhh1ad#b14(b##R%6%6q%9Eb%b$$ad3b.b&bAD)f.f$$a!$Gf$$a!$G))	
 ))	
 b.b$$ad3b88!$Gbmm55qtDbmm))148 bq%d3bmm))1a!$G
""44OO			 bmm77FN	'Bi&bl6
''	 b-b%%xd;q6Q1Q<Q1	M b]6	 b!6TB.Kb[t4booq}}T2##&Gbhh%%w=bhhd3bmm114DIbmm;;T14P bat<E!35GHEbD9be$? i))1ad;bmm%%qt4b1ad3b  !Qe$?b((!Q4TJbkk14 bllAqt$bllAD!b14(bkk,,a>bQ5t4Ab""Aq!QT:b%%q!$7bF6b$$ad;b%%q%d;booqt$b$$ad3b++QDIb**Aq!$?b$$aAD9b**Aq3*4Hb140b1ad+bAD1b1ad+b$$aAD9bq!QT2b''Aqt<bq!$/b140b''Aq!$?bAqt4bB.bqt48b&&TBbad+bhh  !$/bhh$'*Ebhh  !5tDbmm**Aq!$?bmm//AqtD
--
+
+C
	
 b!!140r   c                  b   dt         j                  j                  d      fD ]  } t         j                  j                  d       t        j                  d       t	        |        dat         j                  j                         }t        |k(  sJ t        j                         }t        |k(  rJ  y )N   r   r   )	r   r   RandomStater   r   r   r   r   r   )r   r   r   s      r   test_rng_interfacer      s     RYY**2./ $
		rB & iinn& ###mmo ###$r   )pytestimportorskipr   r   networkxrQ   networkx.algorithmsr   r1   r   r   r   r   r   r   r   r   markslowr   r%   r   r   <module>r      s    V!   7 ) 		r 
		 B*o1r $ $r   