B
    `                 @   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   W/home/dcms/DCMS/lib/python3.7/site-packages/networkx/tests/test_all_random_functions.pyt   s    

r   c       #      C   sT  d}d}d }}d }}d } } }	 }
 }}d } }}d}dddg}t d	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
 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 j+|| d
 ddg}tt j,|| d
 dddd}tt j-j.||| d
 tt j-j/|| d
 tt jj0j&||| d
 tt jj0j1||| d
 dd }tt j2||| d
 ddd g}d!d"d#gd"d$d%gd#d%dgg}tt j3||| d
 tt j4|||| d
 tt$j5||| d
 tt j6j7|| d
 tt j8|||| d
 tt j9||||| d
 tt j:|||||| d
 tt j;|| d
 tt j<||| d
 tt j=|| d
 tt j>|| d
 tt j?j@||| d
 tt jA|||| d
 d&} tt jB| |||| d
 tt jC||| d
 tt jD||| d
 tt jE||| d
 tt jF||| d
 tt jG|| d
 tt jH|| d
 tt jI|||| d
 tt jJ|||| d
 tt jK|||| d
 tt jL|dd'd(g| 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
 tt jTd|| d
 tt jU||| d
 tt jV||||| d
 tt jW|||| d
 tt jX||	|
| d
 tt jY|| d)d* tt jZd| d)d* tt j[|| d
 tt j-j\|| d
 tt j-j]d+| d
 d,dd(d-d.d/g}!tt j-j^||!| d0 tt jj0j_|||| d
 tt jj0j`|||| d
 t jajb}"t|"d1dd2d'dd| dd3	 tt jc|| d
 d S )4N   
      g?g      ?)r   r   r   r         )r   F)r   
normalized	   )Zmax_iterr   di   )r   r   r$   )r   r$   )r   r   r   )r   r   r   r$   )r   r   )r   r   )r   r   )r   r   )r   r   g      ?)r   r   gffffff?g333333?c             S   s   || S )Nr   )uwzr   r   r   kernel_integral   s    z1run_all_random_functions.<locals>.kernel_integralK   i,  g      ?g?g{Gz?gffffff?gQ?i  g?g      ?i  )r   triesgffffff@g?gffffff?g?g      ?)Zcdistributionr      g      ?)Zaverage_degreeZmin_communityr   Zmax_community)dnxZbarbell_graphr   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_orderingapproxZaverage_clusteringZbetweenness_centralityZedge_betweenness_centralityZedge_betweennessZ/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_graph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svpqp1p2Zp_inZp_outalphaZradiusthetasizescolorsGZdeg_sequenceZin_degree_sequencer&   sequenceZaseqZbseqcsZjoint_degreesZjoint_degree_sequenceconstructormappingr(   ZprobsNZcdistZLFRr   r   r   run_all_random_functions(   s
   



rG   c              C   sj   xddt jdgD ]P} t jd td t|  dat j }t|ksNtt }t	|kstqW d S )N   r   r   )
r   r   ZRandomStater   rG   r
   r   r   r   r   )r   r   r   r   r   r   test_rng_interface   s    

rI   )ZpytestZimportorskipr   r   Znetworkxr,   Znetworkx.algorithmsr   r/   r   r
   r   r   r   r   r   rG   markZslowrI   r   r   r   r   <module>   s   


 )