§
    bŠtjw  ã                   óþ   — d Z ddlZg d¢Z ej        d¬¦  «        dd„¦   «         Z ej        d¬¦  «        dd„¦   «         Z ej        d¬¦  «        dd„¦   «         Zej        d	„ ¦   «         Zej        dd
„¦   «         Z	dS )z 
Eigenvalue spectrum of graphs.
é    N)Úlaplacian_spectrumÚadjacency_spectrumÚmodularity_spectrumÚnormalized_laplacian_spectrumÚbethe_hessian_spectrumÚweight)Ú
edge_attrsc                 óŠ   — ddl }|j                             t          j        | |¬¦  «                             ¦   «         ¦  «        S )a¨  Returns eigenvalues of the Laplacian of G

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

    weight : string or None, optional (default='weight')
       The edge data key used to compute each value in the matrix.
       If None, then each edge has weight 1.

    Returns
    -------
    evals : NumPy array
      Eigenvalues

    Notes
    -----
    For MultiGraph/MultiDiGraph, the edges weights are summed.
    See :func:`~networkx.convert_matrix.to_numpy_array` for other options.

    See Also
    --------
    laplacian_matrix

    Examples
    --------
    The multiplicity of 0 as an eigenvalue of the laplacian matrix is equal
    to the number of connected components of G.

    >>> G = nx.Graph()  # Create a graph with 5 nodes and 3 connected components
    >>> G.add_nodes_from(range(5))
    >>> G.add_edges_from([(0, 2), (3, 4)])
    >>> nx.laplacian_spectrum(G)
    array([0., 0., 0., 2., 2.])

    r   N©r   )ÚscipyÚlinalgÚeigvalshÚnxÚlaplacian_matrixÚtodense©ÚGr   Úsps      úV/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/networkx/linalg/spectrum.pyr   r      sC   € ðN ÐÐÐàŒ9×Ò�bÔ1°!¸FÐCÑCÔC×KÒKÑMÔMÑNÔNÐNó    c                 óŠ   — ddl }|j                             t          j        | |¬¦  «                             ¦   «         ¦  «        S )a#  Return eigenvalues of the normalized Laplacian of G

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

    weight : string or None, optional (default='weight')
       The edge data key used to compute each value in the matrix.
       If None, then each edge has weight 1.

    Returns
    -------
    evals : NumPy array
      Eigenvalues

    Notes
    -----
    For MultiGraph/MultiDiGraph, the edges weights are summed.
    See to_numpy_array for other options.

    See Also
    --------
    normalized_laplacian_matrix
    r   Nr   )r   r   r   r   Únormalized_laplacian_matrixr   r   s      r   r   r   <   sI   € ð6 ÐÐÐàŒ9×ÒÝ
Ô& q°Ð8Ñ8Ô8×@Ò@ÑBÔBñô ð r   c                 óŠ   — ddl }|j                             t          j        | |¬¦  «                             ¦   «         ¦  «        S )a  Returns eigenvalues of the adjacency matrix of G.

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

    weight : string or None, optional (default='weight')
       The edge data key used to compute each value in the matrix.
       If None, then each edge has weight 1.

    Returns
    -------
    evals : NumPy array
      Eigenvalues

    Notes
    -----
    For MultiGraph/MultiDiGraph, the edges weights are summed.
    See to_numpy_array for other options.

    See Also
    --------
    adjacency_matrix
    r   Nr   )r   r   Úeigvalsr   Úadjacency_matrixr   r   s      r   r   r   ^   sB   € ð6 ÐÐÐàŒ9×Ò�RÔ0°¸6ÐBÑBÔB×JÒJÑLÔLÑMÔMÐMr   c                 óâ   — ddl }|                      ¦   «         r,|j                             t	          j        | ¦  «        ¦  «        S |j                             t	          j        | ¦  «        ¦  «        S )aª  Returns eigenvalues of the modularity matrix of G.

    Parameters
    ----------
    G : Graph
       A NetworkX Graph or DiGraph

    Returns
    -------
    evals : NumPy array
      Eigenvalues

    See Also
    --------
    modularity_matrix

    References
    ----------
    .. [1] M. E. J. Newman, "Modularity and community structure in networks",
       Proc. Natl. Acad. Sci. USA, vol. 103, pp. 8577-8582, 2006.
    r   N)r   Úis_directedr   r   r   Údirected_modularity_matrixÚmodularity_matrix)r   r   s     r   r   r   ~   sb   € ð. ÐÐÐà‡}‚}�„ð :ØŒy× Ò ¥Ô!>¸qÑ!AÔ!AÑBÔBÐBàŒy× Ò ¥Ô!5°aÑ!8Ô!8Ñ9Ô9Ð9r   c                 óˆ   — ddl }|j                             t          j        | |¦  «                             ¦   «         ¦  «        S )uþ  Returns eigenvalues of the Bethe Hessian matrix of G.

    Parameters
    ----------
    G : Graph
       A NetworkX Graph or DiGraph

    r : float
       Regularizer parameter

    Returns
    -------
    evals : NumPy array
      Eigenvalues

    See Also
    --------
    bethe_hessian_matrix

    References
    ----------
    .. [1] A. Saade, F. Krzakala and L. ZdeborovÃ¡
       "Spectral clustering of graphs with the bethe hessian",
       Advances in Neural Information Processing Systems. 2014.
    r   N)r   r   r   r   Úbethe_hessian_matrixr   )r   Úrr   s      r   r   r   �   s?   € ð6 ÐÐÐàŒ9×Ò�bÔ5°a¸Ñ;Ô;×CÒCÑEÔEÑFÔFÐFr   r   )N)
Ú__doc__Únetworkxr   Ú__all__Ú_dispatchabler   r   r   r   r   © r   r   ú<module>r(      s  ððð ð Ð Ð Ð ðð ð €ð €Ô˜XÐ&Ñ&Ô&ð(Oð (Oð (Oñ 'Ô&ð(OðV €Ô˜XÐ&Ñ&Ô&ðð ð ñ 'Ô&ððB €Ô˜XÐ&Ñ&Ô&ðNð Nð Nñ 'Ô&ðNð> Ôð:ð :ñ Ôð:ð< ÔðGð Gð Gñ ÔðGð Gð Gr   