Exemple #1
0
def findwalks(cmatrix):
    """ Walks are sequences of linked nodes, that may visit a single node more
    than once. This function finds the number of walks of a given length,
    between any two nodes.
 
     Finds walks.  Note that there is no twalk argument as its value may
     overflow a C++ long.  Wq (the main return) and wlq are indexed by path
     length.  They therefore contain no valid data at index 0.

    Parameters
    ----------
    cmatrix : connection/adjacency matrix

    Returns
    -------
    Wq : 3D matrix, with Wq(i,j,q) = number of walks from 
        'i' to 'j' of length 'q'.
    twalk     total number of walks found
    wlq       walk length distribution as function of 'q'

    Uses the powers of the adjacency matrix to produce numbers of walks
    Note that Wq grows very quickly for larger N,K,q.
    Note: Weights are discarded.

    Written by Olaf Sporns, Indiana University, 2002/2007/2008

    """
    #    logging.error("from_gsl seems not work work")
    #    return
    m = bct.to_gslm(cmatrix.tolist())
    mi = bct.findwalks(m)
    print mi
    minp = bct.from_gsl(mi)
    bct.gsl_free(m)
    bct.gsl_free(mi)
    return np.asarray(minp)
Exemple #2
0
def findwalks(cmatrix):
    """ Walks are sequences of linked nodes, that may visit a single node more
    than once. This function finds the number of walks of a given length,
    between any two nodes.
 
     Finds walks.  Note that there is no twalk argument as its value may
     overflow a C++ long.  Wq (the main return) and wlq are indexed by path
     length.  They therefore contain no valid data at index 0.

    Parameters
    ----------
    cmatrix : connection/adjacency matrix

    Returns
    -------
    Wq : 3D matrix, with Wq(i,j,q) = number of walks from 
        'i' to 'j' of length 'q'.
    twalk     total number of walks found
    wlq       walk length distribution as function of 'q'

    Uses the powers of the adjacency matrix to produce numbers of walks
    Note that Wq grows very quickly for larger N,K,q.
    Note: Weights are discarded.

    Written by Olaf Sporns, Indiana University, 2002/2007/2008

    """
#    logging.error("from_gsl seems not work work")
#    return
    m = bct.to_gslm(cmatrix.tolist())
    mi = bct.findwalks(m)
    print mi
    minp = bct.from_gsl(mi)
    bct.gsl_free(m)
    bct.gsl_free(mi)
    return np.asarray(minp)
Exemple #3
0
def findwalks(*args):
  return _bct.findwalks(*args)
Exemple #4
0
def findwalks(*args):
    return _bct.findwalks(*args)
Exemple #5
0
def findwalks(*args):
  """findwalks(gsl_matrix CIJ) -> std::vector<(p.gsl_matrix)>"""
  return _bct.findwalks(*args)
Exemple #6
0
def findwalks(*args):
    """findwalks(gsl_matrix CIJ) -> std::vector<(p.gsl_matrix)>"""
    return _bct.findwalks(*args)