(self, v)
return B_v
Computes a betweenness preference matrix for a node v
    
        @param v: Node for which the betweenness preference matrix shall 
            be calculated
Computes a betweenness preference matrix for a node v
Computes a betweenness preference matrix for a node v
def BWPrefMatrix(self, v):
        """Computes a betweenness preference matrix for a node v
    
        @param v: Node for which the betweenness preference matrix shall 
            be calculated
        """
        # create first-order network 
        g = HigherOrderNetwork(self)
        
        indeg = len(g.predecessors[v])
        outdeg = len(g.successors[v])

        index_succ = {}
        index_pred = {}
    
        B_v = _np.zeros(shape=(indeg, outdeg))
        
        # Create an index-to-node mapping for predecessors and successors
        i = 0
        for u in g.predecessors[v]:
            index_pred[u] = i
            i = i+1
    
        i = 0
        for w in g.successors[v]:
            index_succ[w] = i
            i = i+1

        # Calculate entries of betweenness preference matrix
        for p in self.paths[2]:
            if p[1] == v:
                B_v[index_pred[p[0]], index_succ[p[2]]] += self.paths[2][p].sum()
    
        return B_v
def BWPrefMatrix ( self , v ) : # create first-order network  g = HigherOrderNetwork ( self ) indeg = len ( g . predecessors [ v ] ) outdeg = len ( g . successors [ v ] ) index_succ = { } index_pred = { } B_v = _np . zeros ( shape = ( indeg , outdeg ) ) # Create an index-to-node mapping for predecessors and successors i = 0 for u in g . predecessors [ v ] : index_pred [ u ] = i i = i + 1 i = 0 for w in g . successors [ v ] : index_succ [ w ] = i i = i + 1 # Calculate entries of betweenness preference matrix for p in self . paths [ 2 ] : if p [ 1 ] == v : B_v [ index_pred [ p [ 0 ] ] , index_succ [ p [ 2 ] ] ] += self . paths [ 2 ] [ p ] . sum ( ) return B_v