U
    ?h!                     @   s   d dl Z e dZd dlZd dlZd dlmZ d dlm	Z	 d a
ejd ej Zed e Zdd Zdd	 Ze jjd
d ZdS )    Nnumpy)approximation)	threshold*   c                 O   sd   t d7 a tt ddd | || tj }t|ks6ttjd t }t|ksVttd dS )z1call one function and check if global RNG changed   , )endr   N)	progressprintnprandomrandnp_rvAssertionErrorseedpy_rv)fargskwdsafter_np_rvafter_py_rv r   Z/var/www/html/venv/lib/python3.8/site-packages/networkx/tests/test_all_random_functions.pyt   s    

r   c           $         s  d}d}d }}d }}d } } }	 }
 }}d } }}d}dddg}t d	d}t d}|d
d |jD  dddddddddddddg}| } } } }}tt j| d tt j| dd tt j| d tt j	| d tt j
|dd d tt j|dd d tt j| d tt jt d d tt j| d tt j| d tt j| d tt j| d tt j| d ttj| d ttj|dd d ttj|dd d ttj| fddd ttj| fddd tt j| d tt j| d tt j| d tt jjj| d tt jjj | d tt jjj!| d tt j"|| d tt jjj#||d d tt jj$j%j&|| d tt jj'j(|| d ddddddg}tt)j*| d tt j+| d tt j,|| d tt j-| d tt j.| d ddidddddddddddd}tt j/| d dddddd d!d!g}tt j0| d d"d#g}tt j1| d tt j2|3  d dd$d$d}tt j4j5|| d tt j4j6| d tt jj7j+|| d tt jj7j8|| d d%d& }tt j9|| d d'd'd(g}d)d*d+gd*d,d-gd+d-dgg} tt j:||  d tt j;||| d tt)j<|| d tt j=j>| d tt j?||| d tt j@|||| d tt jA||||| d tt jB| d tt jC|| d tt jD| d tt jE| d tt jFjG|| d tt jH||| d d.}!tt jI|!||| d tt jJ|| d tt jK|| d tt jL|| d tt jM|| d tt jN| d tt jO| d tt jP||| d tt jQ||| d tt jR||| d tt jS|dd/d0g d tt jT|| d tt jU|| d tt jV|| d tt jW|| d tt jX||| d tt jY||| d tt jZ||| d tt j[d| d tt j\|| d tt j]|||| d tt j^||| d tt j_||	|
 d tt j`| d1d2 tt jad d1d2 tt jb| d tt j4jc| d tt j4jdd3 d d4dd0d5d6d7g}"tt j4je||" d8 tt jj7jf||| d tt jj7jg||| d t jhji}#t|#d9dd:d/dd dd;	 tt jj| d d S )<N   
      g?g      ?)r   r   r   r         c                 s   s   | ]\}}||d fV  qdS )皙?Nr   ).0uvr   r   r   	<genexpr>3   s     z+run_all_random_functions.<locals>.<genexpr>r   F)r   
normalized	   greedy)sourcer   c                    s   t j| d| dS Nr(   r%   )approxsimulated_annealing_tspGZwtr%   r   r   <lambda>O       z*run_all_random_functions.<locals>.<lambda>)methodc                    s   t j| d| dS r*   )r+   threshold_accepting_tspr-   r%   r   r   r/   T   r0   )Zmax_iterr   di   )r   r   r5   )r   r5   )r   r   r   )r   r   r   r5   )r   r   )r   r   )r   r   )r   r   )r   r         ?)r   r   ffffff?g333333?c                 S   s   || S )Nr   )r"   wzr   r   r   kernel_integral   s    z1run_all_random_functions.<locals>.kernel_integralK   i,  g      ?g?g{Gz?gffffff?gQ?i  g?r6   i  )r   triesgffffff@r    r7   g?g      ?)Zcdistributionr      g      ?)Zaverage_degreeZmin_communityr   Zmax_community)knxZbarbell_graphZcycle_graphZadd_weighted_edges_fromedgesr   Zmaximal_independent_setZrich_club_coefficientZrandom_referenceZlattice_referencesigmaomegaZdouble_edge_swapZconnected_double_edge_swapZcomplete_graphZrandom_layoutZfruchterman_reingold_layoutZalgebraic_connectivityZfiedler_vectorZspectral_orderingr+   Zaverage_clusteringr,   r2   Ztraveling_salesman_problemZbetweenness_centralityZedge_betweenness_centralityZ/approximate_current_flow_betweenness_centralityZ
algorithmsZ	communityZkernighan_lin_bisectiontreeZgreedy_branchingZEdmondsZspectral_graph_forgeZasyn_fluidcZconnectivityZedge_augmentationZgreedy_k_edge_augmentationZcoloringZstrategy_random_sequentialr   Zswap_dZconfiguration_modelZdirected_configuration_modelZexpected_degree_graphZrandom_degree_sequence_graphZjoint_degree_graphZrandom_clustered_graphZrandom_shell_graphZrandom_triadZto_directedutilsZrandom_weighted_sampleZweighted_choiceZ	bipartiteZpreferential_attachment_graphZrandom_kernel_graphZstochastic_block_modelZrandom_partition_graphZrandom_threshold_sequenceZ
tournamentZrandom_tournamentZrelaxed_caveman_graphZplanted_partition_graphZgaussian_random_partition_graphZgn_graphZ	gnr_graphZ	gnc_graphZscale_free_graphZdirectedZrandom_uniform_k_out_graphZrandom_k_out_graphZpartial_duplication_graphZduplication_divergence_graphZrandom_geometric_graphZsoft_random_geometric_graphZgeographical_threshold_graphZwaxman_graphZnavigable_small_world_graphZ"thresholded_random_geometric_graphZ!uniform_random_intersection_graphZk_random_intersection_graphZ!general_random_intersection_graphZfast_gnp_random_graphZgnp_random_graphZdense_gnm_random_graphZgnm_random_graphZnewman_watts_strogatz_graphZwatts_strogatz_graphZconnected_watts_strogatz_graphZrandom_regular_graphZbarabasi_albert_graphZextended_barabasi_albert_graphZpowerlaw_cluster_graphZrandom_lobsterZrandom_powerlaw_treeZrandom_powerlaw_tree_sequenceZrandom_treeZpowerlaw_sequenceZzipf_rvZdiscrete_sequenceZrandom_graphZgnmk_random_graph
generatorsZLFR_benchmark_graphZrandom_internet_as_graph)$r   nmklsr#   pqp1Zp2Zp_inZp_outalphaZradiusthetasizescolorsr.   HZdeg_sequenceZin_degree_sequencer8   sequenceZaseqZbseqcsZjoint_degreesZjoint_degree_sequenceconstructormappingr:   ZprobsNZcdistZLFRr   r%   r   run_all_random_functions(   s0   








rW   c                  C   sf   dt jdfD ]P} t jd td t|  dat j }t|ksLtt }t	|kstqd S )N   r   r   )
r   r   ZRandomStater   rW   r
   r   r   r   r   )r   r   r   r   r   r   test_rng_interface   s    

rY   )ZpytestZimportorskipr   r   Znetworkxr>   Znetworkx.algorithmsr   r+   r   r
   r   r   r   r   r   rW   markZslowrY   r   r   r   r   <module>   s   


 7