ó
 ,ľ[c           @   sj   d  Z  d d l Z d j d d d d g  Z d d	 d
 g Z d d  Z d d  Z d   Z d   Z	 d S(   s    
Eigenvalue spectrum of graphs.
i˙˙˙˙Ns   
s%   Aric Hagberg <aric.hagberg@gmail.com>s   Pieter Swart (swart@lanl.gov)s   Dan Schult(dschult@colgate.edu)s1   Jean-Gabriel Young (jean.gabriel.young@gmail.com)t   laplacian_spectrumt   adjacency_spectrumt   modularity_spectrumt   weightc         C   s/   d d l  m } | t j |  d | j    S(   s  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
    i˙˙˙˙(   t   eigvalshR   (   t   scipy.linalgR   t   nxt   laplacian_matrixt   todense(   t   GR   R   (    (    s7   lib/python2.7/site-packages/networkx/linalg/spectrum.pyR       s    c         C   s/   d d l  m } | t j |  d | j    S(   s  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
    i˙˙˙˙(   t   eigvalsR   (   R   R
   R   t   adjacency_matrixR   (   R	   R   R
   (    (    s7   lib/python2.7/site-packages/networkx/linalg/spectrum.pyR   1   s    c         C   sF   d d l  m } |  j   r/ | t j |    S| t j |    Sd S(   sŠ  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.
    i˙˙˙˙(   R
   N(   R   R
   t   is_directedR   t   directed_modularity_matrixt   modularity_matrix(   R	   R
   (    (    s7   lib/python2.7/site-packages/networkx/linalg/spectrum.pyR   O   s    c         C   s:   d d l  m } y d d  l } Wn | d   n Xd  S(   Ni˙˙˙˙(   t   SkipTests   scipy.linalg not available(   t   noseR   R   (   t   moduleR   t   scipy(    (    s7   lib/python2.7/site-packages/networkx/linalg/spectrum.pyt   setup_modulen   s
    (
   t   __doc__t   networkxR   t   joint
   __author__t   __all__R    R   R   R   (    (    (    s7   lib/python2.7/site-packages/networkx/linalg/spectrum.pyt   <module>   s   		