(self, includeSubPaths=True)
return _sparse.coo_matrix( (data, (row, col)), shape=(self.vcount(), self.vcount()) ).tocsr()
Returns a (transposed) random walk transition matrix 
        corresponding to the higher-order network.

        @param includeSubpaths: whether or not to include subpath statistics in the 
            transition probability calculation (default True)
Returns a (transposed) random walk transition matrix 
        corresponding to the higher-order network.
Returns a ( transposed ) random walk transition matrix corresponding to the higher - order network .
def getTransitionMatrix(self, includeSubPaths=True):
        """
        Returns a (transposed) random walk transition matrix 
        corresponding to the higher-order network.

        @param includeSubpaths: whether or not to include subpath statistics in the 
            transition probability calculation (default True)
        """
        row = []
        col = []
        data = []
        D = self.degrees(includeSubPaths=includeSubPaths, weighted=True, mode='OUT')
        for (s,t) in self.edges:
            # either s->t has been observed as a longest path, or we are interested in subpaths as well

            # the following makes sure that we do not accidentially consider zero-weight edges (automatically added by default_dic)
            if (self.edges[(s,t)][1] > 0) or (includeSubPaths and self.edges[(s,t)][0]>0):
                row.append(self.nodes.index(t))
                col.append(self.nodes.index(s))
                if includeSubPaths:
                    count = self.edges[(s,t)].sum()
                else:
                    count = self.edges[(s,t)][1]
                #print((s,t))
                #print(D[self.nodes.index(s)])
                #print(count)
                assert D[self.nodes.index(s)]>0, 'Encountered zero out-degree for node ' + str(s) + ' while weight of link (' + str(s) +  ', ' + str(t) + ') is non-zero.'
                prob = count / D[self.nodes.index(s)]
                if prob < 0 or prob > 1:
                    tn.Log.add('Encountered transition probability outside [0,1] range.', Severity.ERROR)
                    raise ValueError()
                data.append( prob )
    
        data = _np.array(data)
        data = data.reshape(data.size,)

        return _sparse.coo_matrix( (data, (row, col)), shape=(self.vcount(), self.vcount()) ).tocsr()
def getTransitionMatrix ( self , includeSubPaths = True ) : row = [ ] col = [ ] data = [ ] D = self . degrees ( includeSubPaths = includeSubPaths , weighted = True , mode = 'OUT' ) for ( s , t ) in self . edges : # either s->t has been observed as a longest path, or we are interested in subpaths as well # the following makes sure that we do not accidentially consider zero-weight edges (automatically added by default_dic) if ( self . edges [ ( s , t ) ] [ 1 ] > 0 ) or ( includeSubPaths and self . edges [ ( s , t ) ] [ 0 ] > 0 ) : row . append ( self . nodes . index ( t ) ) col . append ( self . nodes . index ( s ) ) if includeSubPaths : count = self . edges [ ( s , t ) ] . sum ( ) else : count = self . edges [ ( s , t ) ] [ 1 ] #print((s,t)) #print(D[self.nodes.index(s)]) #print(count) assert D [ self . nodes . index ( s ) ] > 0 , 'Encountered zero out-degree for node ' + str ( s ) + ' while weight of link (' + str ( s ) + ', ' + str ( t ) + ') is non-zero.' prob = count / D [ self . nodes . index ( s ) ] if prob < 0 or prob > 1 : tn . Log . add ( 'Encountered transition probability outside [0,1] range.' , Severity . ERROR ) raise ValueError ( ) data . append ( prob ) data = _np . array ( data ) data = data . reshape ( data . size , ) return _sparse . coo_matrix ( ( data , ( row , col ) ) , shape = ( self . vcount ( ) , self . vcount ( ) ) ) . tocsr ( )