# 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/Transforms/configuration.py
# CONN_STR = ' <> '
# def label_nodes_to_symm_conns(node_labels):
# def label_symm_conns_to_nodes(conn_labels):
# def find_symm_conn(node_pair_labels, conn_labels):
# def convert_conn_vec_to_adj_matr(conn_vec):
# def convert_adj_matr_to_cfg_matr(adj_matr):


import numpy as np
from ...Common import errors
from ..Transforms import configuration

        n_bins: int
            Number of bins on distance matrix
            If n_bins == 1, edge permutation occurs over all distances

    Returns
    -------
        adj_wgt: ndarray, shape (N, N)
            Undirected, symmetric surrogate adjacency matrix with N nodes
            The edge distribution is preserved, but not strengths
    """

    # 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.')
    errors.check_type(dist, np.ndarray)
    errors.check_dims(dist, 2)
    if not (dist == dist.T).all():
        raise Exception('Distance matrix is not undirected and symmetric.')
    errors.check_type(n_bins, np.int)
    if not n_bins > 0:
        raise Exception('Number of bins should be at least 1')

    # Preliminaries
    n_node = adj.shape[0]
    adj_wgt = np.zeros((n_node, n_node))

    cfg_vec = configuration.convert_adj_matr_to_cfg_matr(adj.reshape(1, n_node, n_node)).reshape(-1)

# 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/Transforms/configuration.py
# CONN_STR = ' <> '
# def label_nodes_to_symm_conns(node_labels):
# def label_symm_conns_to_nodes(conn_labels):
# def find_symm_conn(node_pair_labels, conn_labels):
# def convert_conn_vec_to_adj_matr(conn_vec):
# def convert_adj_matr_to_cfg_matr(adj_matr):


# Path: Echobase/Network/Rewire/geometry.py
import numpy as np
from ...Common import errors
from ..Transforms import configuration


        n_bins: int
            Number of bins on distance matrix
            If n_bins == 1, edge permutation occurs over all distances

    Returns
    -------
        adj_wgt: ndarray, shape (N, N)
            Undirected, symmetric surrogate adjacency matrix with N nodes
            The edge distribution is preserved, but not strengths
    """

    # 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.')
    errors.check_type(dist, np.ndarray)
    errors.check_dims(dist, 2)
    if not (dist == dist.T).all():
        raise Exception('Distance matrix is not undirected and symmetric.')
    errors.check_type(n_bins, np.int)
    if not n_bins > 0:
        raise Exception('Number of bins should be at least 1')

    # Preliminaries
    n_node = adj.shape[0]
    adj_wgt = np.zeros((n_node, n_node))

    cfg_vec = configuration.convert_adj_matr_to_cfg_matr(adj.reshape(1, n_node, n_node)).reshape(-1)

    dist_vec = configuration.convert_adj_matr_to_cfg_matr(dist.reshape(1, n_node, n_node)).reshape(-1)