
    fiF                     "   d dl Z d dlZd dlmZ d dlZd dlZd Z G d d          Z G d d          Z	d Z
 G d	 d
          Z G d d          Z G d d          Z G d d          Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd ZdS )    N)combinationsc                 P    t          d t          | |          D                       S )Nc              3   @   K   | ]\  }}t          ||z
            V  d S Nabs.0abs      /var/www/development/aibuddy-work/election-extract/venv/lib/python3.11/site-packages/networkx/generators/tests/test_geometric.py	<genexpr>zl1dist.<locals>.<genexpr>   s0      00das1q5zz000000    sumzipxys     r   l1distr   
   s'    00c!Qii000000r   c                   0    e Zd ZdZd Zd Zd Zd Zd ZdS )TestRandomGeometricGraphz7Unit tests for :func:`~networkx.random_geometric_graph`c                     t          j        ddd          }t          |          dk    sJ t          j        t          d          dd          }t          |          dk    sJ d S N2         ?*   seed)nxrandom_geometric_graphlenrangeselfGs     r   test_number_of_nodesz-TestRandomGeometricGraph.test_number_of_nodes   s`    %b$R8881vv||||%eBiiB???1vv||||||r   c                 f   t          j        dd          }t          |d          D ]\  }}|||         v r>t          j        |j        |         d         |j        |         d                   dk    sJ Mt          j        |j        |         d         |j        |         d                   dk    rJ dS lTests that pairs of vertices adjacent if and only if they are
        within the prescribed radius.
        r   r      posN)r    r!   r   mathdistnodesr%   r&   uvs       r   test_distancesz'TestRandomGeometricGraph.test_distances   s     %b$// A&& 	S 	SDAqAaDyyyE!2AGAJu4EFF$NNNNN  9QWQZ%6
58IJJdRRRRR	S 	Sr   c                 V   t          j        ddd          }t          |d          D ]\  }}|||         v r9t          |j        |         d         |j        |         d                   dk    sJ Ht          |j        |         d         |j        |         d                   dk    rJ dS )BTests for providing an alternate distance metric to the generator.r   r      pr+   r,   N)r    r!   r   r   r/   r0   s       r   test_pzTestRandomGeometricGraph.test_p&   s     %b$!444 A&& 	P 	PDAqAaDyyagaj/E1BCCtKKKKK "!'!*U"3QWQZ5FGG4OOOOO	P 	Pr   c                    ddl }t          |j                  }t          j        |d          }t          |          t          |          k    sJ t          |d          D ]\  }}|||         v r>t          j        |j	        |         d         |j	        |         d                   dk    sJ Mt          j        |j	        |         d         |j	        |         d                   dk    rJ dS =Tests using values other than sequential numbers as node IDs.r   Nr   r+   r,   )
stringlistascii_lowercaser    r!   r"   r   r-   r.   r/   r%   r=   r/   r&   r1   r2   s         r   test_node_namesz(TestRandomGeometricGraph.test_node_names2   s    V+,,%eT221vvU#### A&& 	S 	SDAqAaDyyyE!2AGAJu4EFF$NNNNN  9QWQZ%6
58IJJdRRRRR	S 	Sr   c                     t          j        dddd          }t          d |j                                        D                       sJ d S )Nr   r   r   coordsr   pos_namec              3   N   K   | ] \  }}t          |d                    dk    V  !dS rC   r+   Nr"   r
   nds      r   r   z9TestRandomGeometricGraph.test_pos_name.<locals>.<genexpr>D   7      EETQ3q{##q(EEEEEEr   )r    r!   allr/   itemsr$   s     r   test_pos_namez&TestRandomGeometricGraph.test_pos_nameB   sN    %b$R(KKKEEQW]]__EEEEEEEEEEr   N)	__name__
__module____qualname____doc__r'   r3   r9   rA   rO    r   r   r   r      ss        AA  S S S
P 
P 
PS S S F F F F Fr   r   c                   <    e Zd ZdZd Zd Zd Zd Zd Zd Z	d Z
d	S )
TestSoftRandomGeometricGraphz<Unit tests for :func:`~networkx.soft_random_geometric_graph`c                     t          j        ddd          }t          |          dk    sJ t          j        t          d          dd          }t          |          dk    sJ d S r   )r    soft_random_geometric_graphr"   r#   r$   s     r   r'   z1TestSoftRandomGeometricGraph.test_number_of_nodesJ   s`    *2t"===1vv||||*599dDDD1vv||||||r   c                     t          j        dd          }t          |d          D ]L\  }}|||         v r=t          j        |j        |         d         |j        |         d                   dk    sJ MdS r)   )r    rX   r   r-   r.   r/   r0   s       r   r3   z+TestSoftRandomGeometricGraph.test_distancesP   s     *2t44 A&& 	O 	ODAqAaDyyyE!2AGAJu4EFF$NNNN	O 	Or   c                     d }t          j        ddd          }t          |d          D ]C\  }}|||         v r4 ||j        |         d         |j        |         d                   dk    sJ DdS )	r5   c                 P    t          d t          | |          D                       S )Nc              3   @   K   | ]\  }}t          ||z
            V  d S r   r   r	   s      r   r   zDTestSoftRandomGeometricGraph.test_p.<locals>.dist.<locals>.<genexpr>a   0      88das1q5zz888888r   r   r   s     r   r.   z1TestSoftRandomGeometricGraph.test_p.<locals>.dist`   '    88c!Qii888888r   r   r   r6   r7   r+   r,   N)r    rX   r   r/   r%   r.   r&   r1   r2   s        r   r9   z#TestSoftRandomGeometricGraph.test_p\   s    	9 	9 	9 *2tq999 A&& 	J 	JDAqAaDyytAGAJu-qwqz%/@AATIIII	J 	Jr   c                 ^   ddl }t          |j                  }t          j        |d          }t          |          t          |          k    sJ t          |d          D ]L\  }}|||         v r=t          j        |j	        |         d         |j	        |         d                   dk    sJ MdS r;   )
r=   r>   r?   r    rX   r"   r   r-   r.   r/   r@   s         r   rA   z,TestSoftRandomGeometricGraph.test_node_namesi   s    V+,,*5$771vvU#### A&& 	O 	ODAqAaDyyyE!2AGAJu4EFF$NNNN	O 	Or   c                 .   d}dfdt          |          D             }t          j        dd|          }t          j        dd|          }t	          |                                          t	          |                                          k    sJ dS )zwTests default p_dict = 0.5 returns graph with edge count <= RGG with
        same n, radius, dim and positions
        r   r+   c                 D    i | ]}|d  t                    D             S )c                 4    g | ]}t          j                     S rT   )random)r
   is     r   
<listcomp>zOTestSoftRandomGeometricGraph.test_p_dist_default.<locals>.<dictcomp>.<listcomp>|   s    777q6=??777r   )r#   )r
   r2   dims     r   
<dictcomp>zDTestSoftRandomGeometricGraph.test_p_dist_default.<locals>.<dictcomp>|   s0    NNNAq77E#JJ777NNNr   r   )r,   N)r#   r    r!   rX   r"   edges)r%   r/   r,   RGGSRGGrg   s        @r   test_p_dist_defaultz0TestSoftRandomGeometricGraph.test_p_dist_defaultv   s     NNNNuNNN'Dc:::-b$C@@@4::<<  C		$4$4444444r   c                 n    d }t          j        dd|          }t          |j                  dk    sJ dS );Tests if p_dict = 0 returns disconnected graph with 0 edgesc                     dS Nr   rT   r.   s    r   p_distz=TestSoftRandomGeometricGraph.test_p_dist_zero.<locals>.p_dist       1r   r   r   rr   r   N)r    rX   r"   ri   r%   rr   r&   s      r   test_p_dist_zeroz-TestSoftRandomGeometricGraph.test_p_dist_zero   sI    	 	 	 *2tFCCC17||q      r   c                     t          j        dddd          }t          d |j                                        D                       sJ d S )Nr   r   r   rC   rD   c              3   N   K   | ] \  }}t          |d                    dk    V  !dS rG   rH   rI   s      r   r   z=TestSoftRandomGeometricGraph.test_pos_name.<locals>.<genexpr>   rL   r   )r    rX   rM   r/   rN   r$   s     r   rO   z*TestSoftRandomGeometricGraph.test_pos_name   sN    *2t"xPPPEEQW]]__EEEEEEEEEEr   N)rP   rQ   rR   rS   r'   r3   r9   rA   rl   rv   rO   rT   r   r   rV   rV   G   s        FF  
O 
O 
OJ J JO O O	5 	5 	5! ! !F F F F Fr   rV   c                     | j         |         | j         |         }}|d         |d         }	}|d         |d         }}
|
|z    |||	          |z  z  |k    S )a~  Returns ``True`` if and only if the nodes whose attributes are
    ``du`` and ``dv`` should be joined, according to the threshold
    condition for geographical threshold graphs.

    ``G`` is an undirected NetworkX graph, and ``u`` and ``v`` are nodes
    in that graph. The nodes must have node attributes ``'pos'`` and
    ``'weight'``.

    ``metric`` is a distance metric.
    r,   weight)r/   )r&   r1   r2   thetaalphametricdudvu_posv_posu_weightv_weights               r   joinr      sa     WQZBe9bi5EHr(|hHx66%#7#75#@@EIIr   c                   0    e Zd ZdZd Zd Zd Zd Zd ZdS )TestGeographicalThresholdGraphz=Unit tests for :func:`~networkx.geographical_threshold_graph`c                     t          j        ddd          }t          |          dk    sJ t          j        t          d          dd          }t          |          dk    sJ d S )Nr   d   r   r   )r    geographical_threshold_graphr"   r#   r$   s     r   r'   z3TestGeographicalThresholdGraph.test_number_of_nodes   s`    +B"===1vv||||+E"IIsDDD1vv||||||r   c           	          t          j        dd          }t          |d          D ]P\  }}|||         v r!t          |||ddt          j                  sJ 0t          |||ddt          j                  rJ QdS )zoTests that pairs of vertices adjacent if and only if their
        distances meet the given threshold.
        r   
   r+   N)r    r   r   r   r-   r.   r0   s       r   r3   z-TestGeographicalThresholdGraph.test_distances   s     +B33 A&& 	< 	<DAqAaDyyAq!RTY777777  1aR;;;;;;	< 	<r   c           	          t          j        ddt                    }t          |d          D ]F\  }}|||         v rt	          |||ddt                    sJ +t	          |||ddt                    rJ GdS )r5   r   r   r}   r+   r   N)r    r   r   r   r   r0   s       r   test_metricz*TestGeographicalThresholdGraph.test_metric   s     +B6BBB A&& 	9 	9DAqAaDyyAq!RV444444  1aR888888	9 	9r   c                 n    d }t          j        dd|          }t          |j                  dk    sJ dS )rn   c                     dS rp   rT   rq   s    r   rr   z?TestGeographicalThresholdGraph.test_p_dist_zero.<locals>.p_dist   rs   r   r   r6   rt   r   N)r    r   r"   ri   ru   s      r   rv   z/TestGeographicalThresholdGraph.test_p_dist_zero   sI    	 	 	 +B&AAA17||q      r   c                    t           j        } |ddddd          }t          d |j                                        D                       sJ t          d |j                                        D                       sJ d S )	Nr   r   r   rC   wtr   rE   weight_namec              3   N   K   | ] \  }}t          |d                    dk    V  !dS rG   rH   rI   s      r   r   zFTestGeographicalThresholdGraph.test_pos_weight_name.<locals>.<genexpr>   rL   r   c              3   4   K   | ]\  }}|d          dk    V  dS r   r   NrT   rI   s      r   r   zFTestGeographicalThresholdGraph.test_pos_weight_name.<locals>.<genexpr>   .      ;;41a1T7Q;;;;;;;r   )r    r   rM   r/   rN   )r%   gtgr&   s      r   test_pos_weight_namez3TestGeographicalThresholdGraph.test_pos_weight_name   s    -CCb8FFFEEQW]]__EEEEEEEE;;17==??;;;;;;;;;;r   N)	rP   rQ   rR   rS   r'   r3   r   rv   r   rT   r   r   r   r      se        GG  < < <
9 
9 
9! ! !< < < < <r   r   c                   *    e Zd ZdZd Zd Zd Zd ZdS )TestWaxmanGraphz;Unit tests for the :func:`~networkx.waxman_graph` function.c                     t          j        dddd          }t          |          dk    sJ t          j        t          d          ddd          }t          |          dk    sJ d S )Nr         ?皙?r   r   r    waxman_graphr"   r#   r$   s     r   test_number_of_nodes_1z&TestWaxmanGraph.test_number_of_nodes_1   sb    OBSr2221vv||||OE"IIsCb9991vv||||||r   c                     t          j        dddd          }t          |          dk    sJ t          j        t          d          ddd          }t          |          dk    sJ d S )Nr   r   r   r6   )Lr   r$   s     r   test_number_of_nodes_2z&TestWaxmanGraph.test_number_of_nodes_2   sb    OBSA...1vv||||OE"IIsC15551vv||||||r   c                 j    t          j        dddt                    }t          |          dk    sJ dS )r5   r   r   r   r   N)r    r   r   r"   r$   s     r   r   zTestWaxmanGraph.test_metric   s3     OBS8881vv||||||r   c                     t          j        ddddd          }t          d |j                                        D                       sJ d S )Nr   r   r   r   rC   rD   c              3   N   K   | ] \  }}t          |d                    dk    V  !dS rG   rH   rI   s      r   r   z0TestWaxmanGraph.test_pos_name.<locals>.<genexpr>   rL   r   )r    r   rM   r/   rN   r$   s     r   rO   zTestWaxmanGraph.test_pos_name   sO    OBSrHEEEEEQW]]__EEEEEEEEEEr   N)rP   rQ   rR   rS   r   r   r   rO   rT   r   r   r   r      s[        EE      F F F F Fr   r   c                       e Zd Zd Zd Zd Zd Zd Zej	        
                    d eddd	                    d
             ZdS )TestNavigableSmallWorldGraphc                    t          j        dddd          }t          j        dd                                          }t          j        ||          sJ t          j        dddd          }t          j        g d                                          }t          j        ||          sJ t          j        dddd          }t          j        dg                                          }t          j        ||          sJ d S )	N   r6   r   r   )r8   qr      r8   r   rg   )r   r   r   )r    navigable_small_world_graphgrid_2d_graphto_directedis_isomorphic
grid_graph)r%   r&   ggs      r   test_navigable_small_worldz7TestNavigableSmallWorldGraph.test_navigable_small_world   s    *1QR@@@a##//112&&&&&*1QA>>>]999%%11332&&&&&*1QA>>>]A3++--2&&&&&&&r   c                     t          j        t          j        d          5  t          j        dddd           d d d            d S # 1 swxY w Y   d S )Nz.*p must be >= 1matchr   r   r6   r   pytestraisesr    NetworkXExceptionr   r%   s    r   test_invalid_diameter_valuez8TestNavigableSmallWorldGraph.test_invalid_diameter_value   s    ]2/7IJJJ 	? 	?*1QA>>>>	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	?   AAAc                     t          j        t          j        d          5  t          j        dddd           d d d            d S # 1 swxY w Y   d S )Nz.*q must be >= 0r   r   r6   r   r   r   s    r   )test_invalid_long_range_connections_valuezFTestNavigableSmallWorldGraph.test_invalid_long_range_connections_value   s    ]2/7IJJJ 	@ 	@*1RQ????	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@r   c                     t          j        t          j        d          5  t          j        ddddd           d d d            d S # 1 swxY w Y   d S )Nz.*r must be >= 0r   r   r6   r   r   )r8   r   rrg   r   r   s    r   4test_invalid_exponent_for_decaying_probability_valuezQTestNavigableSmallWorldGraph.test_invalid_exponent_for_decaying_probability_value  s    ]2/7IJJJ 	E 	E*1Q"!DDDD	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E   AAAc                     t          j        dddddd          }t          j        ddt           j                  }t           j                            ||          sJ d	S )
z%Smoke test for radius in range [0, 1]r   r6   r   r   r+   r   )r8   r   r   rg   r   )create_usingN)r    r   r   DiGraphutilsgraphs_equal)r%   r&   expecteds      r   test_r_between_0_and_1z3TestNavigableSmallWorldGraph.test_r_between_0_and_1  s^     *1Q#12NNN#AqrzBBBx$$Q1111111r   r   i	  i
  r   c                 F   t          j        ddd|          }t          j        ddd|          }t          j        ddd|          }|                                |                                k    sJ |                                |                                k    sJ dS )aG  The probability of adding a long-range edge scales with `1 / dist**r`,
        so a navigable_small_world graph created with r < 1 should generally
        result in more edges than a navigable_small_world graph with r >= 1
        (for 0 < q << n).

        N.B. this is probabilistic, so this test may not hold for all seeds.   r   r   )r   r   r   r6   r+   N)r    r   number_of_edges)r%   r   G1G2G3s        r   test_r_general_scalingz3TestNavigableSmallWorldGraph.test_r_general_scaling  s     +AcEEE+AadCCC+AadCCC!!##b&8&8&:&:::::!!##b&8&8&:&:::::::r   N)rP   rQ   rR   r   r   r   r   r   r   markparametrizer#   r   rT   r   r   r   r      s        ' ' '? ? ?@ @ @E E E2 2 2 [VUU4r%:%:;;; ; <;; ; ;r   r   c                   6    e Zd ZdZd Zd Zd Zd Zd Zd Z	dS )	#TestThresholdedRandomGeometricGraphzCUnit tests for :func:`~networkx.thresholded_random_geometric_graph`c                     t          j        dddd          }t          |          dk    sJ t          j        t          d          ddd          }t          |          dk    sJ d S )Nr   g?r   r   r   )r    "thresholded_random_geometric_graphr"   r#   r$   s     r   r'   z8TestThresholdedRandomGeometricGraph.test_number_of_nodes!  sd    1"c3RHHH1vv||||1%))S#BOOO1vv||||||r   c                     t          j        dddd          }t          |d          D ]L\  }}|||         v r=t          j        |j        |         d         |j        |         d                   dk    sJ MdS )	r*   r   r   r   r   r   r+   r,   N)r    r   r   r-   r.   r/   r0   s       r   r3   z2TestThresholdedRandomGeometricGraph.test_distances'  s     1"dCbIII A&& 	O 	ODAqAaDyyyE!2AGAJu4EFF$NNNN	O 	Or   c                     d }t          j        ddddd          }t          |d          D ]C\  }}|||         v r4 ||j        |         d	         |j        |         d	                   dk    sJ Dd
S )r5   c                 P    t          d t          | |          D                       S )Nc              3   @   K   | ]\  }}t          ||z
            V  d S r   r   r	   s      r   r   zKTestThresholdedRandomGeometricGraph.test_p.<locals>.dist.<locals>.<genexpr>8  r]   r   r   r   s     r   r.   z8TestThresholdedRandomGeometricGraph.test_p.<locals>.dist7  r^   r   r   r   r   r6   r   )r8   r   r+   r,   Nr    r   r   r/   r_   s        r   r9   z*TestThresholdedRandomGeometricGraph.test_p3  s    	9 	9 	9 1"dC12NNN A&& 	J 	JDAqAaDyytAGAJu-qwqz%/@AATIIII	J 	Jr   c                 d   ddl }t          |j                  }t          j        |ddd          }t          |          t          |          k    sJ t          |d          D ]L\  }}|||         v r=t          j        |j	        |         d         |j	        |         d                   dk    sJ MdS )	r<   r   Nr   r   r   r   r+   r,   )
r=   r>   r?   r    r   r"   r   r-   r.   r/   r@   s         r   rA   z3TestThresholdedRandomGeometricGraph.test_node_names@  s    V+,,1%sLLL1vvU#### A&& 	O 	ODAqAaDyyyE!2AGAJu4EFF$NNNN	O 	Or   c                     t          j        dddd          }t          |d          D ]<\  }}|||         v r-|j        |         d         |j        |         d         z   dk    sJ =dS )	z~Tests that pairs of vertices adjacent if and only if their sum
        weights exceeds the threshold parameter theta.
        r   r   r   r   r   r+   rz   Nr   r0   s       r   
test_thetaz.TestThresholdedRandomGeometricGraph.test_thetaM  s     1"dCbIII A&& 	L 	LDAqAaDyy
8,qwqz(/CCKKKK	L 	Lr   c                    t           j        } |dddddd          }t          d |j                                        D                       sJ t          d	 |j                                        D                       sJ d S )
Nr   r   r   r   r8   r   r   c              3   N   K   | ] \  }}t          |d                    dk    V  !dS )r8   r+   NrH   rI   s      r   r   zDTestThresholdedRandomGeometricGraph.test_pos_name.<locals>.<genexpr>[  s5      @@13qv;;!#@@@@@@r   c              3   4   K   | ]\  }}|d          dk    V  dS r   rT   rI   s      r   r   zDTestThresholdedRandomGeometricGraph.test_pos_name.<locals>.<genexpr>\  r   r   )r    r   rM   r/   rN   )r%   trggr&   s      r   rO   z1TestThresholdedRandomGeometricGraph.test_pos_nameX  s    4DT3R#4HHH@@@@@@@@@@;;17==??;;;;;;;;;;r   N)
rP   rQ   rR   rS   r'   r3   r9   rA   r   rO   rT   r   r   r   r     s        MM  
O 
O 
OJ J JO O O	L 	L 	L< < < < <r   r   c                      t          j                    } |                     dddifdddifdddifg           ddg}|t          j        | dd	          k    sJ d S )
Nr   position)r   r   r6   )r   r6   r+   )r6   r   )r   r+   )radiusrE   )r    Graphadd_nodes_fromgeometric_edges)r&   expected_edgess     r   "test_geometric_edges_pos_attributer   _  s    


AV$%V$%V$%	
   f%NR/!jQQQQQQQQQr   c                      t          j        d          } d}t          j        t           j        |          5  t          j        | d           d d d            d S # 1 swxY w Y   d S )Nr   zall nodes. must have a 'r   r6   )r   )r    
path_graphr   r   NetworkXErrorr   )r&   msgs     r   "test_geometric_edges_raises_no_posr   l  s    
aA
$C	r's	3	3	3 ( (
1Q''''( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( (s   AA"Ac                  b    t          j        ddddd          } t          |           dk    sJ d S )N      ?r   皙@r   r   betarJ   gammamean_degreer   )r    "geometric_soft_configuration_graphr"   r&   s    r   test_number_of_nodes_S1r   s  s=    
-Cs	 	 	A q66S======r   c                  4   t          j        ddddd          } t          j        | d          }t          |          dk    sJ t          j        | d          }t          |          dk    sJ t          j        | d	          }t          |          dk    sJ d S )
Nr   r   r   r   r   r   kappar{   r   )r    r   get_node_attributesr"   )r&   kappasthetasradiis       r   test_set_attributes_S1r  z  s    
-Cs	 	 	A #Aw//Fv;;##Aw//Fv;;#"1h//Eu::r   c                     t          j        ddddd          } t          j        | d          }t          |                                          t          |          z  }t          j        |dz
            dk     sJ t          | 	                                          }t          |                                          t          |          z  }t          j        |dz
            d	k     sJ d S )
Ng      @r   r   r   iW  r   r  r   r6   )
r    r   r  r   valuesr"   r-   fabsdictdegree)r&   r  mean_kappasdegreesr   s        r   test_mean_kappas_mean_degree_S1r    s    
-Bcr	 	 	A #Aw//Ffmmoo&&V4K9[2%&&,,,,188::Ggnn&&''#g,,6K9[2%&&******r   c                  0   t                               t          d          d          } t          j        d|           }t          |          dk    sJ t          j        |d          } t          d |                                 D                       sJ d S )N  r   r6   )r   r  r  c              3   "   K   | ]
}|d k    V  dS )r   NrT   )r
   r  s     r   r   z&test_dict_kappas_S1.<locals>.<genexpr>  s&      88uu{888888r   )	r
  fromkeysr#   r    r   r"   r  rM   r  )r  r&   s     r   test_dict_kappas_S1r    s    ]]5;;++F
-1VDDDAq66T>>>>#Aw//F888888888888r   c                      t          j        ddddd          } t          j        ddddd          }t          j        |           t          j        |          k     sJ d S )Nr   r         @r   r   r   g      @r    r   average_clustering)r   r   s     r   test_beta_clustering_S1r    sw    		.Cs
 
 
B 
	.Cs
 
 
B  $$r'<R'@'@@@@@@@r   c                  4   t          j        t          j        d          5  t          j        dddd          } d d d            n# 1 swxY w Y   t          j        t          j        d          5  t
                              t          d	          d          }t          j        d|d
d          } d d d            n# 1 swxY w Y   t          j        t          j        d          5  t          j        dd          } d d d            d S # 1 swxY w Y   d S )NzDPlease provide either kappas, or all 3 of: n, gamma and mean_degree.r   r   r  r   r   )r   r   r   r   z;When kappas is input, n, gamma and mean_degree must not be.r  ffffff@)r   r  r   r   )r   r   )r   r   r    r   r   r
  r  r#   )r&   r  s     r   test_wrong_parameters_S1r    s   	
T
 
 
 
 
 1CRb
 
 
	
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

K
 
 
 
 
 uT{{B//1V3R
 
 

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

T
 
 
 E E 1sDDD	E E E E E E E E E E E E E E E E E Es6   AA
A
1AB>>CC)DDDc                      t          j        t          j        d          5  t          j        ddddd          } d d d            d S # 1 swxY w Y   d S )	Nz3The parameter beta cannot be smaller or equal to 0.r   r   r   r  r   r   r   )r   r   r    r   r   r   s    r   test_negative_beta_S1r    s    	
 U
 
 
 
 
 1s#2B
 
 

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
r   c                  l    t          j        ddddd          } t          j        |           dk    sJ d S )Nr   r   r  r   r   r   r   r  r   s    r   *test_non_zero_clustering_beta_lower_one_S1r    sH    
-Cs	 	 	A  ##a''''''r   c                      d} d}t          j        ddd| d          }t          j        ddd|d          }t          j        |          t          j        |          k    sJ d S )Nr+      g333333?r   r   r   r   )r    r   number_connected_components)low_mean_degreehigh_mean_degreeG_lowG_highs       r   -test_mean_degree_influence_on_connectivity_S1r'    s    O1Csb  E 2Cs0@r  F )%0023Q4 4      r   c                     t          j        ddddd          } t          j        ddddd          }t          j        | d          }t          |                                          t          |          z  }t          j        |d          }t          |                                          t          |          z  }t          j        ||z
            d	k     sJ d S )
Nr   r!  r   r   r   r   r  r  r6   )r    r   r  r   r  r"   r-   r	  )r   r   kappas1mean_kappas1kappas2mean_kappas2s         r   ,test_compare_mean_kappas_different_gammas_S1r-    s    		.Bcqr
 
 
B 
	.Bcqr
 
 
B $R11Gw~~''((3w<<7L$R11Gw~~''((3w<<7L9\L011A555555r   )r-   rd   	itertoolsr   r   networkxr    r   r   rV   r   r   r   r   r   r   r   r   r  r  r  r  r  r  r  r'  r-  rT   r   r   <module>r0     s;     " " " " " "     1 1 16F 6F 6F 6F 6F 6F 6F 6FrEF EF EF EF EF EF EF EFPJ J J"1< 1< 1< 1< 1< 1< 1< 1<hF F F F F F F F4-; -; -; -; -; -; -; -;`>< >< >< >< >< >< >< ><B
R 
R 
R( ( (  	 	 	+ + +9 9 9A A AE E E2
 
 
( ( (  6 6 6 6 6r   