o
    ]Zh!                     @   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   sh   t d7 a tt ddd | |i | tj }t|ksJ tjd t }t|ks-J td dS )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_rv r   W/var/www/auris/lib/python3.10/site-packages/networkx/tests/test_all_random_functions.pyt   s   
r   c           $         s  d}d}d }}d }}d } } }	 }
 }}d } }}d}g d}t dd}t d	}|d
d |jD  g d}| } } } }}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!|| d tt jjj"||d d tt jj#j$j%|| d tt jj&j'|| d g d}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 g d}tt j/| d dd g}tt j0| d tt j1|2  d dd!d!d}tt j3j4|| d tt j3j5| d tt jj6j*|| d tt jj6j7|| d d"d# }tt j8|| d g d$}g d%g d&g d'g} tt j9||  d tt j:||| d tt(j;|| d tt j<j=| d tt 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 jEjF|| d tt jG||| d d(}!tt jH|!||| 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d)d*g d tt jS|| 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 jZd	| d tt j[|| d tt j\|||| d tt j]||| d tt j^||	|
 d tt j_| d+d, tt j`d d+d, tt ja| d tt j3jb| d tt j3jcd- d g d.}"tt j3jd||" d/ tt jj6je||| d tt jj6jf||| d t jgjh}#t|#d0d	d1d)d	d dd2	 tt ji| d d S )3N   
      皙?g      ?)r   r   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   r   r   r   r   r   r   r   r   r   r   r   r   r   F)r   
normalizedr   	   greedy)sourcer   c                       t j| d| dS Nr(   r%   )approxsimulated_annealing_tspGweightr%   r   r   <lambda>O       z*run_all_random_functions.<locals>.<lambda>)methodc                    r*   r+   )r,   threshold_accepting_tspr.   r%   r   r   r1   V   r2   )Zmax_iterr   )dir6   r5   r5   r6      )r   r   r7   )r   r7   )r   r   r   r7   )r   r   r8   r8   )r   r   r8   )r   r   r   r   r9   )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_integral)K   r?   i,  )g      ?皙?{Gz?)r@   gffffff?Q?)rA   rB   r   i  g?r:   i  )r   triesgffffff@)r    r   r:   r;   g?g      ?)Zcdistributionr      g      ?)Zaverage_degreeZmin_communityr   Zmax_community)j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-   r4   Ztraveling_salesman_problemZbetweenness_centralityZedge_betweenness_centralityZ/approximate_current_flow_betweenness_centralityZ
algorithmsZ	communityZkernighan_lin_bisectiontreeZgreedy_branchingZ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_labeled_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p1p2Zp_inZp_outalphaZradiusthetasizescolorsr/   HZ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  






r_   c                  C   sf   dt jdfD ](} t jd td t|  dat j }t|ks&J t }t|ks0J qd S )N   r   r   )	r   r   ZRandomStater   r_   r
   r   r   r   )r   r   r   r   r   r   test_rng_interface   s   

ra   )ZpytestZimportorskipr   r   ZnetworkxrE   Znetworkx.algorithmsr   r,   r   r
   r   r   r   r   r   r_   markZslowra   r   r   r   r   <module>   s     


 :