§
    bŠtj  ã                   ó4  — d Z ddlZddlmZ g 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S )z,
Generators for random intersection graphs.
é    N)Úpy_random_state)Ú!uniform_random_intersection_graphÚk_random_intersection_graphÚ!general_random_intersection_graphé   T)ÚgraphsÚreturns_graphc                 ó‚   — ddl m} |                     | |||¦  «        }t          j        |t          | ¦  «        ¦  «        S )u“  Returns a uniform random intersection graph.

    Parameters
    ----------
    n : int
        The number of nodes in the first bipartite set (nodes)
    m : int
        The number of nodes in the second bipartite set (attributes)
    p : float
        Probability of connecting nodes between bipartite sets
    seed : integer, random_state, or None (default)
        Indicator of random number generation state.
        See :ref:`Randomness<randomness>`.

    See Also
    --------
    gnp_random_graph

    References
    ----------
    .. [1] K.B. Singer-Cohen, Random Intersection Graphs, 1995,
       PhD thesis, Johns Hopkins University
    .. [2] Fill, J. A., Scheinerman, E. R., and Singer-Cohen, K. B.,
       Random intersection graphs when m = !(n):
       An equivalence theorem relating the evolution of the g(n, m, p)
       and g(n, p) models. Random Struct. Algorithms 16, 2 (2000), 156â€“176.
    r   )Ú	bipartite)Únetworkx.algorithmsr   Úrandom_graphÚnxÚprojected_graphÚrange)ÚnÚmÚpÚseedr   ÚGs         ú^/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/networkx/generators/intersection.pyr   r      sH   € ð< .Ð-Ð-Ð-Ð-Ð-à×Ò˜q ! Q¨Ñ-Ô-€AÝÔ˜a¥ q¡¤Ñ*Ô*Ð*ó    c           	      óR  — t          j        | |z   ¦  «        }t          | | |z   ¦  «        }t          | ¦  «        D ]L}|                     ||¦  «        }|                     t          |gt          |¦  «        z  |¦  «        ¦  «         ŒMt          j        |t          | ¦  «        ¦  «        S )a0  Returns a intersection graph with randomly chosen attribute sets for
    each node that are of equal size (k).

    Parameters
    ----------
    n : int
        The number of nodes in the first bipartite set (nodes)
    m : int
        The number of nodes in the second bipartite set (attributes)
    k : float
        Size of attribute set to assign to each node.
    seed : integer, random_state, or None (default)
        Indicator of random number generation state.
        See :ref:`Randomness<randomness>`.

    See Also
    --------
    gnp_random_graph, uniform_random_intersection_graph

    References
    ----------
    .. [1] Godehardt, E., and Jaworski, J.
       Two models of random intersection graphs and their applications.
       Electronic Notes in Discrete Mathematics 10 (2001), 129--132.
    )r   Úempty_graphr   ÚsampleÚadd_edges_fromÚzipÚlenr   )r   r   Úkr   r   ÚmsetÚvÚtargetss           r   r   r   3   s—   € õ8 	Œ�q˜1‘uÑÔ€AÝ��A˜‘E‰?Œ?€DÝ�1‰XŒXð ;ð ;ˆØ—+’+˜d AÑ&Ô&ˆØ	×Ò�˜a˜S¥3 w¡<¤<Ñ/°Ñ9Ô9Ñ:Ô:Ð:Ð:ÝÔ˜a¥ q¡¤Ñ*Ô*Ð*r   c                 óŠ  — t          |¦  «        |k    rt          d¦  «        ‚t          j        | |z   ¦  «        }t	          | | |z   ¦  «        }t	          | ¦  «        D ]F}t          ||¦  «        D ]3\  }}|                     ¦   «         |k     r|                     ||¦  «         Œ4ŒGt          j        |t	          | ¦  «        ¦  «        S )u  Returns a random intersection graph with independent probabilities
    for connections between node and attribute sets.

    Parameters
    ----------
    n : int
        The number of nodes in the first bipartite set (nodes)
    m : int
        The number of nodes in the second bipartite set (attributes)
    p : list of floats of length m
        Probabilities for connecting nodes to each attribute
    seed : integer, random_state, or None (default)
        Indicator of random number generation state.
        See :ref:`Randomness<randomness>`.

    See Also
    --------
    gnp_random_graph, uniform_random_intersection_graph

    References
    ----------
    .. [1] Nikoletseas, S. E., Raptopoulos, C., and Spirakis, P. G.
       The existence and efficient construction of large independent sets
       in general random intersection graphs. In ICALP (2004), J. DÂ´Ä±az,
       J. KarhumÂ¨aki, A. LepistÂ¨o, and D. Sannella, Eds., vol. 3142
       of Lecture Notes in Computer Science, Springer, pp. 1029â€“1040.
    z(Probability list p must have m elements.)	r   Ú
ValueErrorr   r   r   r   ÚrandomÚadd_edger   )	r   r   r   r   r   r   Úur    Úqs	            r   r   r   W   s¾   € õ< ˆ1�v„v�‚{€{ÝÐCÑDÔDÐDÝ
Œ�q˜1‘uÑÔ€AÝ��A˜‘E‰?Œ?€DÝ�1‰XŒXð !ð !ˆÝ˜˜a‘L”Lð 	!ð 	!‰DˆAˆqØ�{Š{‰}Œ}˜qÒ Ð Ø—
’
˜1˜aÑ Ô Ð øð	!õ Ô˜a¥ q¡¤Ñ*Ô*Ð*r   )N)
Ú__doc__Únetworkxr   Únetworkx.utilsr   Ú__all__Ú_dispatchabler   r   r   © r   r   ú<module>r.      s$  ððð ð Ð Ð Ð Ø *Ð *Ð *Ð *Ð *Ð *ðð ð €ð €�ÑÔØ€Ô˜¨TÐ2Ñ2Ô2ð+ð +ð +ñ 3Ô2ñ Ôð+ðD €�ÑÔØ€Ô˜¨TÐ2Ñ2Ô2ð+ð +ð +ñ 3Ô2ñ Ôð+ðD €�ÑÔØ€Ô˜¨TÐ2Ñ2Ô2ð$+ð $+ð $+ñ 3Ô2ñ Ôð$+ð $+ð $+r   