# Path: Echobase/Common/errors.py
# def check_dims(arr, nd):
# def check_type(obj, typ):
# def check_function(obj):
# def check_path(path):
# def make_path(path):
# def check_path_overwrite(path):
# def check_has_key(dictionary, key_ref):
# 
# Path: Echobase/Network/Metrics/globaltopo.py
# def synchronizability(adj):
#     """
#     Function for computing synchronizability given the network topology
# 
#     Parameters
#     ----------
#         adj: ndarray, shape (N, N)
#             Undirected, symmetric adjacency matrix with N nodes
# 
#     Returns
#     -------
#         sync: float
#             Synchronizability of the adjacency matrix (lambda_2 / lambda_max)
#     """
# 
#     # Standard param checks
#     errors.check_type(adj, np.ndarray)
#     errors.check_dims(adj, 2)
#     if not (adj == adj.T).all():
#         raise Exception('Adjacency matrix is not undirected and symmetric.')
# 
#     # Get the degree vector of the adj
#     deg_vec = np.sum(adj, axis=0)
#     deg_matr = np.diag(deg_vec)
# 
#     # Laplacian
#     lapl = deg_matr - adj
# 
#     # Compute eigenvalues and eigenvectors, ensure they are real
#     eigval, eigvec = np.linalg.eig(lapl)
#     eigval = np.real(eigval)
# 
#     # Sort smallest to largest eigenvalue
#     eigval = np.sort(eigval)
#     sync = np.abs(eigval[1] / eigval[-1])
# 
#     return sync
# 
# Path: Echobase/Network/Transforms/lesion.py
# def node_lesion(adj, node_list):
# def edge_lesion(adj, edge_list):


import numpy as np
from ...Common import errors
from .globaltopo import synchronizability
from ..Transforms import lesion
Measurements of nodal importance (centrality)

Created by: Ankit Khambhati

Change Log
----------
2016/03/10 - Implemented DegrCentral, EvecCentral, SyncCentral pipes
"""

from __future__ import division



def node_strength(adj):
    """
    Function for computing sum of connection strengths from a node

    Parameters
    ----------
        adj: ndarray, shape (N, N)
            Undirected, symmetric adjacency matrix with N nodes

    Returns
    -------
        deg_vec: ndarray, shape (N,)
            Node strength vector over N variates
    """

    # Standard param checks
    errors.check_type(adj, np.ndarray)

# Path: Echobase/Common/errors.py
# def check_dims(arr, nd):
# def check_type(obj, typ):
# def check_function(obj):
# def check_path(path):
# def make_path(path):
# def check_path_overwrite(path):
# def check_has_key(dictionary, key_ref):
# 
# Path: Echobase/Network/Metrics/globaltopo.py
# def synchronizability(adj):
#     """
#     Function for computing synchronizability given the network topology
# 
#     Parameters
#     ----------
#         adj: ndarray, shape (N, N)
#             Undirected, symmetric adjacency matrix with N nodes
# 
#     Returns
#     -------
#         sync: float
#             Synchronizability of the adjacency matrix (lambda_2 / lambda_max)
#     """
# 
#     # Standard param checks
#     errors.check_type(adj, np.ndarray)
#     errors.check_dims(adj, 2)
#     if not (adj == adj.T).all():
#         raise Exception('Adjacency matrix is not undirected and symmetric.')
# 
#     # Get the degree vector of the adj
#     deg_vec = np.sum(adj, axis=0)
#     deg_matr = np.diag(deg_vec)
# 
#     # Laplacian
#     lapl = deg_matr - adj
# 
#     # Compute eigenvalues and eigenvectors, ensure they are real
#     eigval, eigvec = np.linalg.eig(lapl)
#     eigval = np.real(eigval)
# 
#     # Sort smallest to largest eigenvalue
#     eigval = np.sort(eigval)
#     sync = np.abs(eigval[1] / eigval[-1])
# 
#     return sync
# 
# Path: Echobase/Network/Transforms/lesion.py
# def node_lesion(adj, node_list):
# def edge_lesion(adj, edge_list):


# Path: Echobase/Network/Metrics/nodetopo.py
import numpy as np
from ...Common import errors
from .globaltopo import synchronizability
from ..Transforms import lesion

Measurements of nodal importance (centrality)

Created by: Ankit Khambhati

Change Log
----------
2016/03/10 - Implemented DegrCentral, EvecCentral, SyncCentral pipes
"""

from __future__ import division



def node_strength(adj):
    """
    Function for computing sum of connection strengths from a node

    Parameters
    ----------
        adj: ndarray, shape (N, N)
            Undirected, symmetric adjacency matrix with N nodes

    Returns
    -------
        deg_vec: ndarray, shape (N,)
            Node strength vector over N variates
    """

    # Standard param checks
    errors.check_type(adj, np.ndarray)

    errors.check_dims(adj, 2)