B
    ,µ[ï
  ã               @   sP   d Z ddlZd ddddg¡Zdd	d
gZddd„Zddd	„Zdd
„ Zdd„ Z	dS )z 
Eigenvalue spectrum of graphs.
é    NÚ
z%Aric Hagberg <aric.hagberg@gmail.com>zPieter Swart (swart@lanl.gov)zDan Schult(dschult@colgate.edu)z1Jean-Gabriel Young (jean.gabriel.young@gmail.com)Úlaplacian_spectrumÚadjacency_spectrumÚmodularity_spectrumÚweightc             C   s"   ddl m} |tj| |d ¡ ƒS )a  Return 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_matrix for other options.

    See Also
    --------
    laplacian_matrix
    r   )Úeigvalsh)r   )Úscipy.linalgr   ÚnxZlaplacian_matrixÚtodense)ÚGr   r   © r   ú7lib/python3.7/site-packages/networkx/linalg/spectrum.pyr      s    c             C   s"   ddl m} |tj| |d ¡ ƒS )a  Return 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_matrix for other options.

    See Also
    --------
    adjacency_matrix
    r   )Úeigvals)r   )r   r   r	   Zadjacency_matrixr
   )r   r   r   r   r   r   r   1   s    c             C   s4   ddl m} |  ¡ r"|t | ¡ƒS |t | ¡ƒS dS )a©  Return 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   )r   N)r   r   Zis_directedr	   Zdirected_modularity_matrixZmodularity_matrix)r   r   r   r   r   r   O   s    c             C   s2   ddl m} ydd l}W n   |dƒ‚Y nX d S )Nr   )ÚSkipTestzscipy.linalg not available)Znoser   r   )Úmoduler   Zscipyr   r   r   Úsetup_modulen   s
    r   )r   )r   )
Ú__doc__Znetworkxr	   ÚjoinÚ
__author__Ú__all__r   r   r   r   r   r   r   r   Ú<module>   s   


