Ë
    Ü›7in  ã                   óJ   — d Z ddlZdgZ ej                  d¬«      dd„«       Zy)z
Spectral bipartivity measure.
é    NÚspectral_bipartivityÚweight)Ú
edge_attrsc           
      ó  — ddl }t        | «      }t        j                  | ||¬«      }|j                  j                  |«      }|j                  j                  | «      }d||z   z  }|€Ft        |j                  «       j                  «       |j                  «       j                  «       z  «      S t        t        |t        t        |«      «      «      «      }	i }
|D ]/  }|	|   }|j                  ||«      |j                  ||«      z  |
|<   Œ1 |
S )u9  Returns the spectral bipartivity.

    Parameters
    ----------
    G : NetworkX graph

    nodes : list or container  optional(default is all nodes)
      Nodes to return value of spectral bipartivity contribution.

    weight : string or None  optional (default = 'weight')
      Edge data key to use for edge weights. If None, weights set to 1.

    Returns
    -------
    sb : float or dict
       A single number if the keyword nodes is not specified, or
       a dictionary keyed by node with the spectral bipartivity contribution
       of that node as the value.

    Examples
    --------
    >>> from networkx.algorithms import bipartite
    >>> G = nx.path_graph(4)
    >>> bipartite.spectral_bipartivity(G)
    1.0

    Notes
    -----
    This implementation uses Numpy (dense) matrices which are not efficient
    for storing large sparse graphs.

    See Also
    --------
    color

    References
    ----------
    .. [1] E. Estrada and J. A. RodrÃ­guez-VelÃ¡zquez, "Spectral measures of
       bipartivity in complex networks", PhysRev E 72, 046105 (2005)
    r   N)r   g      à?)ÚscipyÚlistÚnxÚto_numpy_arrayÚlinalgÚexpmÚfloatÚdiagonalÚsumÚdictÚzipÚrangeÚlenÚitem)ÚGÚnodesr   ÚspÚnodelistÚAÚexpAÚexpmAÚcoshAÚindexÚsbÚnÚis                úc/home/rose/Desktop/poly/venv/lib/python3.12/site-packages/networkx/algorithms/bipartite/spectral.pyr   r   
   së   € óT äA‹w€HÜ
×Ñ˜!˜X¨fÔ5€AØ9‰9>‰>˜!Ó€DØI‰IN‰N˜A˜2Ó€EØ4˜%‘<Ñ €EØ€}äU—^‘^Ó%×)Ñ)Ó+¨d¯m©m«o×.AÑ.AÓ.CÑCÓDÐDô ”S˜¤5¬¨X«Ó#7Ó8Ó9ˆØˆÛˆAØa‘ˆAØ—J‘J˜q !Ó$ t§y¡y°°A£Ñ6ˆBˆqŠEð ð ˆ	ó    )Nr   )Ú__doc__Únetworkxr	   Ú__all__Ú_dispatchabler   © r"   r!   Ú<module>r(      s8   ðñó à!Ð
"€ð €×Ñ˜XÔ&ò:ó 'ñ:r"   