コード例 #1
0
ファイル: measures.py プロジェクト: omerch/pyconto
def strengths(cmatrix, edgetype):
    """ Computes strength for an undirected or directed graph.
    
    Strength is the sum of all connection weights for individual nodes.

    In a directed graph, instrength (outstrength) is the sum of incoming
    (outgoing) connection weights for individual nodes. The strength is the
    sum of instrength and outstrength.
    

    Parameters
    ----------

    cmatrix : connection/adjacency matrix
    
    
    Returns
    -------
    
    edgetype == 'undirected'
    
        str : strength for all vertices
    
    edgetype == 'directed
    
        str : strength for all vertices (indegree + outdegree)

%         is   = instrength for all vertices
%         os   = outstrength for all vertices

    Reference: Barrat et al. (2004). Contributor: OS.

    Olaf Sporns, Indiana University, 2007/2008

    """
    if edgetype == 'undirected':
        m = bct.to_gslm(cmatrix.tolist())
        strr = bct.strengths_und(m)
        strnp = bct.from_gsl(strr)
        bct.gsl_free(m)
        bct.gsl_free(strr)
        return np.asarray(strnp)
    else:
        m = bct.to_gslm(cmatrix.tolist())
        strr = bct.strengths_dir(m)
        strnp = bct.from_gsl(strr)
        bct.gsl_free(m)
        bct.gsl_free(strr)
        return np.asarray(strnp)
コード例 #2
0
ファイル: measures.py プロジェクト: aestrivex/pyconto
def strengths(cmatrix, edgetype):
    """ Computes strength for an undirected or directed graph.
    
    Strength is the sum of all connection weights for individual nodes.

    In a directed graph, instrength (outstrength) is the sum of incoming
    (outgoing) connection weights for individual nodes. The strength is the
    sum of instrength and outstrength.
    

    Parameters
    ----------

    cmatrix : connection/adjacency matrix
    
    
    Returns
    -------
    
    edgetype == 'undirected'
    
        str : strength for all vertices
    
    edgetype == 'directed
    
        str : strength for all vertices (indegree + outdegree)

%         is   = instrength for all vertices
%         os   = outstrength for all vertices

    Reference: Barrat et al. (2004). Contributor: OS.

    Olaf Sporns, Indiana University, 2007/2008

    """
    if edgetype == 'undirected':
        m = bct.to_gslm(cmatrix.tolist())
        strr = bct.strengths_und(m)
        strnp = bct.from_gsl(strr)
        bct.gsl_free(m)
        bct.gsl_free(strr)
        return np.asarray(strnp)
    else:
        m = bct.to_gslm(cmatrix.tolist())
        strr = bct.strengths_dir(m)
        strnp = bct.from_gsl(strr)
        bct.gsl_free(m)
        bct.gsl_free(strr)
        return np.asarray(strnp)
コード例 #3
0
ファイル: bct.py プロジェクト: aestrivex/pyconto
def strengths_und(*args):
  return _bct.strengths_und(*args)
コード例 #4
0
def strengths_und(*args):
    return _bct.strengths_und(*args)
コード例 #5
0
ファイル: bct.py プロジェクト: aestrivex/pyconto
def strengths_und(*args):
  """strengths_und(gsl_matrix CIJ) -> gsl_vector"""
  return _bct.strengths_und(*args)
コード例 #6
0
ファイル: bct.py プロジェクト: omerch/pyconto
def strengths_und(*args):
    """strengths_und(gsl_matrix CIJ) -> gsl_vector"""
    return _bct.strengths_und(*args)