Ë
    D^(h×O  ã                   óp  — d Z ddlZddlZddlmZ ddlZddlmZm	Z	 g d¢Z
 ej                  dd¬«       eddg«      dd	„«       «       Z e	d
«       ej                  ddd¬«      dd„«       «       Z ej                  ddd¬«      dd„«       Z ej                  dd¬«      dd„«       Z ej                  dd¬«      dd„«       Z e	d
«       ej                  dd¬«      dd„«       «       Z e	d
«       ej                  dd¬«      dd„«       «       Z e	d
«       ej                  dd¬«      dd„«       «       Zd„ Zy)z0
Generators and functions for bipartite graphs.
é    N)Úreduce)Únodes_or_numberÚpy_random_state)Úconfiguration_modelÚhavel_hakimi_graphÚreverse_havel_hakimi_graphÚalternating_havel_hakimi_graphÚpreferential_attachment_graphÚrandom_graphÚgnmk_random_graphÚcomplete_bipartite_graphT)ÚgraphsÚreturns_graphé   c                 ój  ‡— t        j                  d|«      }|j                  «       rt        j                  d«      ‚| \  } }|\  }Št	        | t
        j                  «      r-t	        |t
        j                  «      r‰D �cg c]  }| |z   ‘Œ	 c}Š|j                  |d¬«       |j                  ‰d¬«       t        |«      t        |«      t        ‰«      z   k7  rt        j                  d«      ‚|j                  ˆfd„|D «       «       dt        |«      › dt        ‰«      › d	�|j                  d
<   |S c c}w )a   Returns the complete bipartite graph `K_{n_1,n_2}`.

    The graph is composed of two partitions with nodes 0 to (n1 - 1)
    in the first and nodes n1 to (n1 + n2 - 1) in the second.
    Each node in the first is connected to each node in the second.

    Parameters
    ----------
    n1, n2 : integer or iterable container of nodes
        If integers, nodes are from `range(n1)` and `range(n1, n1 + n2)`.
        If a container, the elements are the nodes.
    create_using : NetworkX graph instance, (default: nx.Graph)
       Return graph of this type.

    Notes
    -----
    Nodes are the integers 0 to `n1 + n2 - 1` unless either n1 or n2 are
    containers of nodes. If only one of n1 or n2 are integers, that
    integer is replaced by `range` of that integer.

    The nodes are assigned the attribute 'bipartite' with the value 0 or 1
    to indicate which bipartite set the node belongs to.

    This function is not imported in the main namespace.
    To use it use nx.bipartite.complete_bipartite_graph
    r   úDirected Graph not supported©Ú	bipartiter   z,Inputs n1 and n2 must contain distinct nodesc              3   ó4   •K  — | ]  }‰D ]  }||f–— Œ
 Œ y ­w©N© )Ú.0ÚuÚvÚbottoms      €úf/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/networkx/algorithms/bipartite/generators.pyú	<genexpr>z+complete_bipartite_graph.<locals>.<genexpr>A   s!   øè ø€ Ò9 °&Ò9¨Q�a˜”VÐ9�VÑ9ùs   ƒzcomplete_bipartite_graph(z, ú)Úname)ÚnxÚempty_graphÚis_directedÚNetworkXErrorÚ
isinstanceÚnumbersÚIntegralÚadd_nodes_fromÚlenÚadd_edges_fromÚgraph)Ún1Ún2Úcreate_usingÚGÚtopÚir   s         @r   r   r      s  ø€ ô: 	�‰�q˜,Ó'€AØ‡}�}„Ü×ÑÐ=Ó>Ð>à�G€BˆØ�J€BˆÜ�"”g×&Ñ&Ô'¬J°r¼7×;KÑ;KÔ,LØ"(Ö)˜Q�"�q“&Ò)ˆØ×Ñ�S AÐÔ&Ø×Ñ�V qÐÔ)Ü
ˆ1ƒv”�S“œC ›KÑ'Ò'Ü×ÑÐMÓNÐNØ×ÑÓ9 SÔ9Ô9Ø1´#°c³(°¸2¼cÀ&»k¸]È!ÐL€A‡G�GˆF�OØ€Hùò *s   Á?D0é   Úbipartite_configuration_model)r   r   r   c                 óB  ‡‡— t        j                  d|t         j                  ¬«      }|j                  «       rt        j                  d«      ‚t        | «      }t        |«      }t        | «      }t        |«      }||k(  st        j                  d|› d|› �«      ‚t        |||«      }t        | «      dk(  st        | «      dk(  r|S t        |«      D �	cg c]  }	|	g| |	   z  ‘Œ }
}	|
D ��cg c]  }|D ]  }|‘Œ Œ c}}Št        |||z   «      D �	cg c]  }	|	g||	|z
     z  ‘Œ }
}	|
D ��cg c]  }|D ]  }|‘Œ Œ c}}Š|j                  ‰«       |j                  ‰«       |j                  ˆˆfd„t        |«      D «       «       d|_        |S c c}	w c c}}w c c}	w c c}}w )aã  Returns a random bipartite graph from two given degree sequences.

    Parameters
    ----------
    aseq : list
       Degree sequence for node set A.
    bseq : list
       Degree sequence for node set B.
    create_using : NetworkX graph instance, optional
       Return graph of this type.
    seed : integer, random_state, or None (default)
        Indicator of random number generation state.
        See :ref:`Randomness<randomness>`.

    The graph is composed of two partitions. Set A has nodes 0 to
    (len(aseq) - 1) and set B has nodes len(aseq) to (len(bseq) - 1).
    Nodes from set A are connected to nodes in set B by choosing
    randomly from the possible free stubs, one in A and one in B.

    Notes
    -----
    The sum of the two sequences must be equal: sum(aseq)=sum(bseq)
    If no graph type is specified use MultiGraph with parallel edges.
    If you want a graph with no parallel edges use create_using=Graph()
    but then the resulting degree sequences might not be exact.

    The nodes are assigned the attribute 'bipartite' with the value 0 or 1
    to indicate which bipartite set the node belongs to.

    This function is not imported in the main namespace.
    To use it use nx.bipartite.configuration_model
    r   ©Údefaultr   ú/invalid degree sequences, sum(aseq)!=sum(bseq),ú,c              3   ó2   •K  — | ]  }‰|   ‰|   g–— Œ y ­wr   r   )r   r0   ÚastubsÚbstubss     €€r   r   z&configuration_model.<locals>.<genexpr>ˆ   s   øè ø€ ÒA°�f˜Q‘i ¨¡Ô+ÑAùs   ƒr2   )r    r!   Ú
MultiGraphr"   r#   r(   ÚsumÚ_add_nodes_with_bipartite_labelÚmaxÚrangeÚshuffler)   r   )ÚaseqÚbseqr-   Úseedr.   ÚlenaÚlenbÚsumaÚsumbr   ÚstubsÚsubseqÚxr9   r:   s                @@r   r   r   F   s…  ù€ ôF 	�‰�q˜,´·±Ô>€AØ‡}�}„Ü×ÑÐ=Ó>Ð>ô ˆt‹9€DÜˆt‹9€DÜˆt‹9€DÜˆt‹9€Dà�4Š<Ü×ÑØ=¸d¸VÀ1ÀTÀFÐKó
ð 	
ô 	(¨¨4°Ó6€Aä
ˆ4ƒy�A‚~œ˜T› ašØˆô %*¨$£KÖ0˜qˆaˆS�4˜‘7‹]Ð0€EÐ0Ø#×4�F¨VÒ4¨ŠaÐ4ˆaÓ4€Fä+0°°t¸d±{Ó+CÖD aˆaˆS�4˜˜D™‘>Ó!ÐD€EÐDØ#×4�F¨VÒ4¨ŠaÐ4ˆaÓ4€Fð 	‡L�L�ÔØ‡L�L�Ôà×ÑÔA´U¸4³[ÔAÔAà,€A„FØ€Hùò 1ùÛ4ùâDùÛ4s   ÃFÃ)FÄFÄ(FÚbipartite_havel_hakimi_graphc                 ó<  — t        j                  d|t         j                  ¬«      }|j                  «       rt        j                  d«      ‚t        | «      }t        |«      }t        | «      }t        |«      }||k(  st        j                  d|› d|› �«      ‚t        |||«      }t        | «      dk(  st        | «      dk(  r|S t        |«      D �cg c]	  }| |   |g‘Œ }	}t        |||z   «      D �cg c]  }|||z
     |g‘Œ }
}|	j                  «        |	ru|	j                  «       \  }}|dk(  rn\|
j                  «        |
| d D ]@  }|d   }|j                  ||«       |dxx   dz  cc<   |d   dk(  sŒ0|
j                  |«       ŒB |	rŒud|_        |S c c}w c c}w )	a©  Returns a bipartite graph from two given degree sequences using a
    Havel-Hakimi style construction.

    The graph is composed of two partitions. Set A has nodes 0 to
    (len(aseq) - 1) and set B has nodes len(aseq) to (len(bseq) - 1).
    Nodes from the set A are connected to nodes in the set B by
    connecting the highest degree nodes in set A to the highest degree
    nodes in set B until all stubs are connected.

    Parameters
    ----------
    aseq : list
       Degree sequence for node set A.
    bseq : list
       Degree sequence for node set B.
    create_using : NetworkX graph instance, optional
       Return graph of this type.

    Notes
    -----
    The sum of the two sequences must be equal: sum(aseq)=sum(bseq)
    If no graph type is specified use MultiGraph with parallel edges.
    If you want a graph with no parallel edges use create_using=Graph()
    but then the resulting degree sequences might not be exact.

    The nodes are assigned the attribute 'bipartite' with the value 0 or 1
    to indicate which bipartite set the node belongs to.

    This function is not imported in the main namespace.
    To use it use nx.bipartite.havel_hakimi_graph
    r   r4   r   r6   r7   Nr   rK   ©r    r!   r;   r"   r#   r(   r<   r=   r>   r?   ÚsortÚpopÚadd_edgeÚremover   )rA   rB   r-   r.   ÚnaseqÚnbseqrF   rG   r   r9   r:   Údegreer   Útargets                 r   r   r   Ž   s˜  € ôB 	�‰�q˜,´·±Ô>€AØ‡}�}„Ü×ÑÐ=Ó>Ð>ô �‹I€EÜ�‹I€Eäˆt‹9€DÜˆt‹9€Dà�4Š<Ü×ÑØ=¸d¸VÀ1ÀTÀFÐKó
ð 	
ô 	(¨¨5°%Ó8€Aä
ˆ4ƒy�A‚~œ˜T› ašØˆô %*¨%£LÖ1˜qˆt�A‰w˜ŠlÐ1€FÐ1Ü,1°%¸À¹Ó,GÖH qˆt�A˜‘I‰ Ò"ÐH€FÐHØ
‡K�K„MÙ
Ø—j‘j“l‰ˆ�Ø�QŠ;Øà�‰ŒØ˜f˜W˜XÐ&ò 	&ˆFØ�q‘	ˆAØ�J‰J�q˜!ÔØ�1‹I˜‰N‹IØ�a‰y˜A‹~Ø—‘˜fÕ%ð	&ò ð ,€A„FØ€Hùò# 2ùÚHs   ÃFÃ1Fc                 ó:  — t        j                  d|t         j                  ¬«      }|j                  «       rt        j                  d«      ‚t        | «      }t        |«      }t        | «      }t        |«      }||k(  st        j                  d|› d|› �«      ‚t        |||«      }t        | «      dk(  st        | «      dk(  r|S t        |«      D �cg c]	  }| |   |g‘Œ }	}t        |||z   «      D �cg c]  }|||z
     |g‘Œ }
}|	j                  «        |
j                  «        |	rd|	j                  «       \  }}|dk(  rnK|
d| D ]@  }|d   }|j                  ||«       |dxx   dz  cc<   |d   dk(  sŒ0|
j                  |«       ŒB |	rŒdd|_        |S c c}w c c}w )a¬  Returns a bipartite graph from two given degree sequences using a
    Havel-Hakimi style construction.

    The graph is composed of two partitions. Set A has nodes 0 to
    (len(aseq) - 1) and set B has nodes len(aseq) to (len(bseq) - 1).
    Nodes from set A are connected to nodes in the set B by connecting
    the highest degree nodes in set A to the lowest degree nodes in
    set B until all stubs are connected.

    Parameters
    ----------
    aseq : list
       Degree sequence for node set A.
    bseq : list
       Degree sequence for node set B.
    create_using : NetworkX graph instance, optional
       Return graph of this type.

    Notes
    -----
    The sum of the two sequences must be equal: sum(aseq)=sum(bseq)
    If no graph type is specified use MultiGraph with parallel edges.
    If you want a graph with no parallel edges use create_using=Graph()
    but then the resulting degree sequences might not be exact.

    The nodes are assigned the attribute 'bipartite' with the value 0 or 1
    to indicate which bipartite set the node belongs to.

    This function is not imported in the main namespace.
    To use it use nx.bipartite.reverse_havel_hakimi_graph
    r   r4   r   r6   r7   r   Ú$bipartite_reverse_havel_hakimi_graphrM   )rA   rB   r-   r.   rD   rE   rF   rG   r   r9   r:   rT   r   rU   s                 r   r   r   Ù   s–  € ôB 	�‰�q˜,´·±Ô>€AØ‡}�}„Ü×ÑÐ=Ó>Ð>ô ˆt‹9€DÜˆt‹9€DÜˆt‹9€DÜˆt‹9€Dà�4Š<Ü×ÑØ=¸d¸VÀ1ÀTÀFÐKó
ð 	
ô 	(¨¨4°Ó6€Aä
ˆ4ƒy�A‚~œ˜T› ašØˆô %*¨$£KÖ0˜qˆt�A‰w˜ŠlÐ0€FÐ0Ü+0°°t¸d±{Ó+CÖD aˆt�A˜‘H‰~˜qÒ!ÐD€FÐDØ
‡K�K„MØ
‡K�K„MÙ
Ø—j‘j“l‰ˆ�Ø�QŠ;Øà˜Q˜vÐ&ò 	&ˆFØ�q‘	ˆAØ�J‰J�q˜!ÔØ�1‹I˜‰N‹IØ�a‰y˜A‹~Ø—‘˜fÕ%ð	&ò ð 4€A„FØ€Hùò# 1ùÚDs   ÃFÃ1Fc                 ó0  — t        j                  d|t         j                  ¬«      }|j                  «       rt        j                  d«      ‚t        | «      }t        |«      }t        | «      }t        |«      }||k(  st        j                  d|› d|› �«      ‚t        |||«      }t        | «      dk(  st        | «      dk(  r|S t        |«      D �cg c]	  }| |   |g‘Œ }	}t        |||z   «      D �cg c]  }|||z
     |g‘Œ }
}|	rù|	j                  «        |	j                  «       \  }}|dk(  rnÐ|
j                  «        |
d|dz   }|
| |dz  z   d }t        ||«      D ��cg c]  }|D ]  }|‘Œ Œ }}}t        |«      t        |«      t        |«      z   k  r|j                  |j                  «       «       |D ]@  }|d   }|j                  ||«       |dxx   dz  cc<   |d   dk(  sŒ0|
j                  |«       ŒB |	rŒùd	|_        |S c c}w c c}w c c}}w )
aã  Returns a bipartite graph from two given degree sequences using
    an alternating Havel-Hakimi style construction.

    The graph is composed of two partitions. Set A has nodes 0 to
    (len(aseq) - 1) and set B has nodes len(aseq) to (len(bseq) - 1).
    Nodes from the set A are connected to nodes in the set B by
    connecting the highest degree nodes in set A to alternatively the
    highest and the lowest degree nodes in set B until all stubs are
    connected.

    Parameters
    ----------
    aseq : list
       Degree sequence for node set A.
    bseq : list
       Degree sequence for node set B.
    create_using : NetworkX graph instance, optional
       Return graph of this type.

    Notes
    -----
    The sum of the two sequences must be equal: sum(aseq)=sum(bseq)
    If no graph type is specified use MultiGraph with parallel edges.
    If you want a graph with no parallel edges use create_using=Graph()
    but then the resulting degree sequences might not be exact.

    The nodes are assigned the attribute 'bipartite' with the value 0 or 1
    to indicate which bipartite set the node belongs to.

    This function is not imported in the main namespace.
    To use it use nx.bipartite.alternating_havel_hakimi_graph
    r   r4   r   r6   r7   é   Nr   Ú(bipartite_alternating_havel_hakimi_graph)r    r!   r;   r"   r#   r(   r<   r=   r>   r?   rN   rO   ÚzipÚappendrP   rQ   r   )rA   rB   r-   r.   rR   rS   rF   rG   r   r9   r:   rT   r   ÚsmallÚlargeÚzrJ   rH   rU   s                      r   r	   r	   #  s  € ôD 	�‰�q˜,´·±Ô>€AØ‡}�}„Ü×ÑÐ=Ó>Ð>ô �‹I€EÜ�‹I€EÜˆt‹9€DÜˆt‹9€Dà�4Š<Ü×ÑØ=¸d¸VÀ1ÀTÀFÐKó
ð 	
ô 	(¨¨5°%Ó8€Aä
ˆ4ƒy�A‚~œ˜T› ašØˆä$)¨%£LÖ1˜qˆt�A‰w˜ŠlÐ1€FÐ1Ü,1°%¸À¹Ó,GÖH qˆt�A˜‘I‰ Ò"ÐH€FÐHÙ
Ø�‰ŒØ—j‘j“l‰ˆ�Ø�QŠ;ØØ�‰ŒØ�q˜6 Q™;Ð'ˆØ˜˜ &¨A¡+Ñ-Ð0Ð1ˆÜ  uÓ-×9�q°qÒ9°!’Ð9�Ð9ˆÑ9Üˆu‹:œ˜E›
¤S¨£ZÑ/Ò/Ø�L‰L˜Ÿ™›Ô%Øò 	&ˆFØ�q‘	ˆAØ�J‰J�q˜!ÔØ�1‹I˜‰N‹IØ�a‰y˜A‹~Ø—‘˜fÕ%ð	&ò ð$ 8€A„FØ€Hùò+ 2ùÚHùó :s   ÃHÃ1HÅ"Hc                 ó€  — t        j                  d|t         j                  ¬«      }|j                  «       rt        j                  d«      ‚|dkD  rt        j                  d|› d�«      ‚t        | «      }t        ||d«      }t        |«      D �cg c]  }|g| |   z  ‘Œ }}|�r	|d   rì|d   d   }|d   j                  |«       |j                  «       |k  st        |«      |k(  r1t        |«      }	|j                  |	d¬«       |j                  ||	«       nxt        |t        |«      «      D �
cg c]  }
|
g|j                  |
«      z  ‘Œ }}
t        d„ |«      }|j                  |«      }	|j                  |	d¬«       |j                  ||	«       |d   rŒì|j                  |d   «       |r�Œ	d	|_        |S c c}w c c}
w )
a^  Create a bipartite graph with a preferential attachment model from
    a given single degree sequence.

    The graph is composed of two partitions. Set A has nodes 0 to
    (len(aseq) - 1) and set B has nodes starting with node len(aseq).
    The number of nodes in set B is random.

    Parameters
    ----------
    aseq : list
       Degree sequence for node set A.
    p :  float
       Probability that a new bottom node is added.
    create_using : NetworkX graph instance, optional
       Return graph of this type.
    seed : integer, random_state, or None (default)
        Indicator of random number generation state.
        See :ref:`Randomness<randomness>`.

    References
    ----------
    .. [1] Guillaume, J.L. and Latapy, M.,
       Bipartite graphs as models of complex networks.
       Physica A: Statistical Mechanics and its Applications,
       2006, 371(2), pp.795-813.
    .. [2] Jean-Loup Guillaume and Matthieu Latapy,
       Bipartite structure of all complex networks,
       Inf. Process. Lett. 90, 2004, pg. 215-221
       https://doi.org/10.1016/j.ipl.2004.03.007

    Notes
    -----
    The nodes are assigned the attribute 'bipartite' with the value 0 or 1
    to indicate which bipartite set the node belongs to.

    This function is not imported in the main namespace.
    To use it use nx.bipartite.preferential_attachment_graph
    r   r4   r   r   zprobability z > 1r   c                 ó   — | |z   S r   r   )rJ   Úys     r   ú<lambda>z/preferential_attachment_graph.<locals>.<lambda>¯  s
   € ¨a°!©e€ ó    Ú'bipartite_preferential_attachment_model)r    r!   r;   r"   r#   r(   r=   r?   rQ   ÚrandomÚadd_noderP   rT   r   Úchoicer   )rA   Úpr-   rC   r.   rR   r   ÚvvÚsourcerU   ÚbÚbbÚbbstubss                r   r
   r
   q  s”  € ôR 	�‰�q˜,´·±Ô>€AØ‡}�}„Ü×ÑÐ=Ó>Ð>àˆ1‚uÜ×Ñ ¨a¨S°Ð5Ó6Ð6ä�‹I€EÜ'¨¨5°!Ó4€AÜ!& u£Ö	.˜Aˆ1ˆ#��Q‘‹-Ð	.€BÐ	.Ú
Ø�ŠeØ˜‘U˜1‘XˆFØˆq‰E�L‰L˜Ô Ø�{‰{‹}˜qÒ ¤C¨£F¨e¢OÜ˜Q›�Ø—
‘
˜6¨Q�
Ô/Ø—
‘
˜6 6Õ*ä16°u¼cÀ!»fÓ1EÖF¨A�q�c˜AŸH™H Q›KÓ'ÐF�ÐFä Ñ!3°RÓ8�àŸ™ WÓ-�Ø—
‘
˜6¨Q�
Ô/Ø—
‘
˜6 6Ô*ð �‹eð 	�	‰	�"�Q‘%Ôó! ð" 7€A„FØ€Hùò' 
/ùò Gs   ÂF6Ä.F;c                 ó  — t        j                  «       }t        || |«      }|rt        j                  |«      }d| › d|› d|› d�|_        |dk  r|S |dk\  rt        j
                  | |«      S t        j                  d|z
  «      }d}d}|| k  ryt        j                  d|j                  «       z
  «      }	|dz   t        |	|z  «      z   }||k\  r|| k  r||z
  }|dz   }||k\  r|| k  rŒ|| k  r|j                  || |z   «       || k  rŒy|r‚d}d}|| k  ryt        j                  d|j                  «       z
  «      }	|dz   t        |	|z  «      z   }||k\  r|| k  r||z
  }|dz   }||k\  r|| k  rŒ|| k  r|j                  | |z   |«       || k  rŒy|S )uo  Returns a bipartite random graph.

    This is a bipartite version of the binomial (ErdÅ‘s-RÃ©nyi) graph.
    The graph is composed of two partitions. Set A has nodes 0 to
    (n - 1) and set B has nodes n to (n + m - 1).

    Parameters
    ----------
    n : int
        The number of nodes in the first bipartite set.
    m : int
        The number of nodes in the second bipartite set.
    p : float
        Probability for edge creation.
    seed : integer, random_state, or None (default)
        Indicator of random number generation state.
        See :ref:`Randomness<randomness>`.
    directed : bool, optional (default=False)
        If True return a directed graph

    Notes
    -----
    The bipartite random graph algorithm chooses each of the n*m (undirected)
    or 2*nm (directed) possible edges with probability p.

    This algorithm is $O(n+m)$ where $m$ is the expected number of edges.

    The nodes are assigned the attribute 'bipartite' with the value 0 or 1
    to indicate which bipartite set the node belongs to.

    This function is not imported in the main namespace.
    To use it use nx.bipartite.random_graph

    See Also
    --------
    gnp_random_graph, configuration_model

    References
    ----------
    .. [1] Vladimir Batagelj and Ulrik Brandes,
       "Efficient generation of large random networks",
       Phys. Rev. E, 71, 036113, 2005.
    zfast_gnp_random_graph(r7   r   r   r   g      ð?éÿÿÿÿ)r    ÚGraphr=   ÚDiGraphr   r   ÚmathÚlogrf   ÚintrP   )
ÚnÚmri   rC   Údirectedr.   Úlpr   ÚwÚlrs
             r   r   r   ¹  s´  € ô\ 	�‰‹
€AÜ'¨¨1¨aÓ0€AÙÜ�J‰J�q‹MˆØ% a S¨¨!¨¨A¨a¨S°Ð2€A„FàˆA‚vØˆØˆA‚vÜ×*Ñ*¨1¨aÓ0Ð0ä	�‰�#˜‘'Ó	€Bà	€AØ
€AØ
ˆaŠ%Ü�X‰X�c˜DŸK™K›MÑ)Ó*ˆØ�‰E”C˜˜R™“LÑ ˆØ�1Šf˜˜QšØ�A‘ˆAØ�A‘ˆAð �1Šf˜˜Q›ð ˆqŠ5Ø�J‰J�q˜!˜a™%Ô ð ˆa‹%ñ ð ˆØˆØ�!ŠeÜ—‘˜# §¡£Ñ-Ó.ˆBØ�A‘œ˜B ™G›Ñ$ˆAØ�q’&˜Q šUØ˜‘E�Ø˜‘E�ð �q’&˜Q ›Uð �1ŠuØ—
‘
˜1˜q™5 !Ô$ð �!‹eð €Hrd   c                 ó6  — t        j                  «       }t        || |«      }|rt        j                  |«      }d| › d|› d|› d�|_        | dk(  s|dk(  r|S | |z  }||k\  rt        j
                  | ||¬«      S |j                  d¬«      D � �cg c]  \  } }|d   d	k(  sŒ| ‘Œ }} }t        t        |«      t        |«      z
  «      }	d	}
|
|k  rG|j                  |«      }|j                  |	«      }|||   v rŒ/|j                  ||«       |
dz  }
|
|k  rŒG|S c c}} w )
a  Returns a random bipartite graph G_{n,m,k}.

    Produces a bipartite graph chosen randomly out of the set of all graphs
    with n top nodes, m bottom nodes, and k edges.
    The graph is composed of two sets of nodes.
    Set A has nodes 0 to (n - 1) and set B has nodes n to (n + m - 1).

    Parameters
    ----------
    n : int
        The number of nodes in the first bipartite set.
    m : int
        The number of nodes in the second bipartite set.
    k : int
        The number of edges
    seed : integer, random_state, or None (default)
        Indicator of random number generation state.
        See :ref:`Randomness<randomness>`.
    directed : bool, optional (default=False)
        If True return a directed graph

    Examples
    --------
    from nx.algorithms import bipartite
    G = bipartite.gnmk_random_graph(10,20,50)

    See Also
    --------
    gnm_random_graph

    Notes
    -----
    If k > m * n then a complete bipartite graph is returned.

    This graph is a bipartite version of the `G_{nm}` random graph model.

    The nodes are assigned the attribute 'bipartite' with the value 0 or 1
    to indicate which bipartite set the node belongs to.

    This function is not imported in the main namespace.
    To use it use nx.bipartite.gnmk_random_graph
    zbipartite_gnm_random_graph(r7   r   r   )r-   T)Údatar   r   )r    rq   r=   rr   r   r   ÚnodesÚlistÚsetrh   rP   )rv   rw   ÚkrC   rx   r.   Ú	max_edgesÚdr/   r   Ú
edge_countr   r   s                r   r   r     s(  € ôZ 	�‰‹
€AÜ'¨¨1¨aÓ0€AÙÜ�J‰J�q‹MˆØ*¨1¨#¨Q¨q¨c°°1°#°QÐ7€A„FØˆA‚v��a’ØˆØ�A‘€IØˆI‚~Ü×*Ñ*¨1¨a¸aÔ@Ð@àŸ™ d˜Ó+×
C‘��A¨q°©~ÀÓ/BŠ1Ð
C€CÑ
CÜ”#�a“&œ3˜s›8Ñ#Ó$€FØ€JØ
�qŠ.à�K‰K˜ÓˆØ�K‰K˜ÓˆØ��!‘‰9Øà�J‰J�q˜!ÔØ˜!‰OˆJð �q‹.ð €Hùó Ds   ÂDÂDc                 ó  — | j                  t        ||z   «      «       t        t        t        |«      dg|z  «      «      }|j	                  t        t        t        |||z   «      dg|z  «      «      «       t        j                  | |d«       | S )Nr   r   r   )r'   r?   Údictr[   Úupdater    Úset_node_attributes)r.   rD   rE   rl   s       r   r=   r=   W  st   € Ø×Ñ”U˜4 $™;Ó'Ô(ÜŒS”�t“˜q˜c D™jÓ)Ó*€AØ‡H�HŒT”#”e˜D $¨¡+Ó.°°°d±
Ó;Ó<Ô=Ü×Ñ˜1˜a Ô-Ø€Hrd   r   )NN)NF)Ú__doc__rs   r%   Ú	functoolsr   Únetworkxr    Únetworkx.utilsr   r   Ú__all__Ú_dispatchabler   r   r   r   r	   r
   r   r   r=   r   rd   r   ú<module>r�      s¤  ðñó Û Ý ã ß ;ò	€ð €×Ñ˜¨TÔ2Ù�!�Q�Óò)ó ó 3ð)ñX �ÓØ€×ÑÐ6¸tÐSWÔXòCó Yó ðCðL €×ÑÐ5¸dÐRVÔWòGó XðGðT €×Ñ˜¨TÔ2òFó 3ðFðR €×Ñ˜¨TÔ2òJó 3ðJñZ �ÓØ€×Ñ˜¨TÔ2òCó 3ó ðCñL �ÓØ€×Ñ˜¨TÔ2òRó 3ó ðRñj �ÓØ€×Ñ˜¨TÔ2òBó 3ó ðBóJrd   