(self, normalized = True, lanczosVecs = 15, maxiter = 20)
return b
Returns the (sparse) Fiedler vector of the higher-order network. The Fiedler 
        vector can be used for a spectral bisectioning of the network.
     
        Note that sparse linear algebra for eigenvalue problems with small eigenvalues 
        is problematic in terms of numerical stability. Consider using the dense version
        of this method in this case. Note also that the sparse Fiedler vector might be scaled by 
        a factor (-1) compared to the dense version.
          
        @param normalized: whether (default) or not to normalize the fiedler vector.
          Normalization is done such that the sum of squares equals one in order to
          get reasonable values as entries might be positive and negative.
        @param lanczosVecs: number of Lanczos vectors to be used in the approximate
            calculation of eigenvectors and eigenvalues. This maps to the ncv parameter 
            of scipy's underlying function eigs. 
        @param maxiter: scaling factor for the number of iterations to be used in the 
            approximate calculation of eigenvectors and eigenvalues. The number of iterations 
            passed to scipy's underlying eigs function will be n*maxiter where n is the 
            number of rows/columns of the Laplacian matrix.
Returns the (sparse) Fiedler vector of the higher-order network. The Fiedler 
        vector can be used for a spectral bisectioning of the network.
     
        Note that sparse linear algebra for eigenvalue problems with small eigenvalues 
        is problematic in terms of numerical stability. Consider using the dense version
        of this method in this case. Note also that the sparse Fiedler vector might be scaled by 
        a factor (-1) compared to the dense version.
Returns the ( sparse ) Fiedler vector of the higher - order network . The Fiedler vector can be used for a spectral bisectioning of the network . Note that sparse linear algebra for eigenvalue problems with small eigenvalues is problematic in terms of numerical stability . Consider using the dense version of this method in this case . Note also that the sparse Fiedler vector might be scaled by a factor ( - 1 ) compared to the dense version .
def getFiedlerVectorSparse(self, normalized = True, lanczosVecs = 15, maxiter = 20):
        """Returns the (sparse) Fiedler vector of the higher-order network. The Fiedler 
        vector can be used for a spectral bisectioning of the network.
     
        Note that sparse linear algebra for eigenvalue problems with small eigenvalues 
        is problematic in terms of numerical stability. Consider using the dense version
        of this method in this case. Note also that the sparse Fiedler vector might be scaled by 
        a factor (-1) compared to the dense version.
          
        @param normalized: whether (default) or not to normalize the fiedler vector.
          Normalization is done such that the sum of squares equals one in order to
          get reasonable values as entries might be positive and negative.
        @param lanczosVecs: number of Lanczos vectors to be used in the approximate
            calculation of eigenvectors and eigenvalues. This maps to the ncv parameter 
            of scipy's underlying function eigs. 
        @param maxiter: scaling factor for the number of iterations to be used in the 
            approximate calculation of eigenvectors and eigenvalues. The number of iterations 
            passed to scipy's underlying eigs function will be n*maxiter where n is the 
            number of rows/columns of the Laplacian matrix.
        """
    
        # NOTE: The transposed matrix is needed to get the "left" eigenvectors
        L = self.getLaplacianMatrix()

        # NOTE: ncv sets additional auxiliary eigenvectors that are computed
        # NOTE: in order to be more confident to find the one with the largest
        # NOTE: magnitude, see https://github.com/scipy/scipy/issues/4987
        maxiter = maxiter*L.get_shape()[0]
        w = _sla.eigs( L, k=2, which="SM", ncv=lanczosVecs, return_eigenvectors=False, maxiter=maxiter )
    
        # compute a sparse LU decomposition and solve for the eigenvector 
        # corresponding to the second largest eigenvalue
        n = L.get_shape()[0]
        b = _np.ones(n)
        evalue = _np.sort(_np.abs(w))[1]
        A = (L[1:n,:].tocsc()[:,1:n] - _sparse.identity(n-1).multiply(evalue))
        b[1:n] = A[0,:].toarray()
    
        lu = _sla.splu(A)
        b[1:n] = lu.solve(b[1:n])

        if normalized:
            b /= np.sqrt(np.inner(b, b))
        return b
def getFiedlerVectorSparse ( self , normalized = True , lanczosVecs = 15 , maxiter = 20 ) : # NOTE: The transposed matrix is needed to get the "left" eigenvectors L = self . getLaplacianMatrix ( ) # NOTE: ncv sets additional auxiliary eigenvectors that are computed # NOTE: in order to be more confident to find the one with the largest # NOTE: magnitude, see https://github.com/scipy/scipy/issues/4987 maxiter = maxiter * L . get_shape ( ) [ 0 ] w = _sla . eigs ( L , k = 2 , which = "SM" , ncv = lanczosVecs , return_eigenvectors = False , maxiter = maxiter ) # compute a sparse LU decomposition and solve for the eigenvector  # corresponding to the second largest eigenvalue n = L . get_shape ( ) [ 0 ] b = _np . ones ( n ) evalue = _np . sort ( _np . abs ( w ) ) [ 1 ] A = ( L [ 1 : n , : ] . tocsc ( ) [ : , 1 : n ] - _sparse . identity ( n - 1 ) . multiply ( evalue ) ) b [ 1 : n ] = A [ 0 , : ] . toarray ( ) lu = _sla . splu ( A ) b [ 1 : n ] = lu . solve ( b [ 1 : n ] ) if normalized : b /= np . sqrt ( np . inner ( b , b ) ) return b