a
    «J5d$  ã                   @   sH   d Z ddlZg d¢Zddd„Zddd„Zdd	d
„Zdd„ Zddd„ZdS )z 
Eigenvalue spectrum of graphs.
é    N)Úlaplacian_spectrumÚadjacency_spectrumÚmodularity_spectrumÚnormalized_laplacian_spectrumÚbethe_hessian_spectrumÚweightc                 C   s*   ddl }ddl}|j tj| |d ¡ ¡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 to_numpy_array for other options.

    See Also
    --------
    laplacian_matrix
    r   N©r   )ÚscipyÚscipy.linalgÚlinalgÚeigvalshÚnxZlaplacian_matrixÚtodense©ÚGr   Úspr	   © r   úT/var/www/html/django/DPS/env/lib/python3.9/site-packages/networkx/linalg/spectrum.pyr      s    r   c                 C   s*   ddl }ddl}|j tj| |d ¡ ¡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   r   Znormalized_laplacian_matrixr   r   r   r   r   r   /   s
    ÿr   c                 C   s*   ddl }ddl}|j tj| |d ¡ ¡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
   r   Úeigvalsr   Zadjacency_matrixr   r   r   r   r   r   Q   s    r   c                 C   s@   ddl }ddl}|  ¡ r*|j t | ¡¡S |j t | ¡¡S d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	   r
   Zis_directedr   r   r   Zdirected_modularity_matrixZmodularity_matrix)r   r   r	   r   r   r   r   q   s
    r   c                 C   s(   ddl }ddl}|j t | |¡ ¡ ¡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   r   Zbethe_hessian_matrixr   )r   Úrr   r	   r   r   r   r      s    r   )r   )r   )r   )N)	Ú__doc__Znetworkxr   Ú__all__r   r   r   r   r   r   r   r   r   Ú<module>   s   	
 
"
 