networkit.algebraic

This module deals with the conversion of graphs into matrices and linear algebra operations on graphs

networkit.algebraic.PageRankMatrix(G, damp=0.85)

Builds the PageRank matrix of the undirected Graph G. This matrix corresponds with the PageRank matrix used in the C++ backend.

G : Graph
The graph.
damp:
Damping factor of the PageRank algorithm (0.85 by default)
pr : ndarray
The N x N page rank matrix of graph.
networkit.algebraic.adjacencyEigenvector(G, order, reverse=False)
networkit.algebraic.adjacencyEigenvectors(G, cutoff=-1, reverse=False)
networkit.algebraic.adjacencyMatrix(G, matrixType='sparse')

Get the adjacency matrix of the graph G.

G : Graph
The graph.
matrixType : string
represent”sparse” or “dense”
scipy.sparse.csr_matrix
The adjacency matrix of the graph.
networkit.algebraic.column(matrix, i)
networkit.algebraic.eigenvectors(matrix, cutoff=-1, reverse=False)

Computes eigenvectors and -values of matrices.

matrix : sparse matrix
The matrix to compute the eigenvectors of
cutoff : int
The maximum (or minimum) magnitude of the eigenvectors needed
reverse : boolean
If set to true, the smaller eigenvalues will be computed before the larger ones
pr : ( [ float ], [ ndarray ] )
A tuple of ordered lists, the first containing the eigenvalues in descending (ascending) magnitude, the second one holding the corresponding eigenvectors
networkit.algebraic.laplacianEigenvector(G, order, reverse=False)
networkit.algebraic.laplacianEigenvectors(G, cutoff=-1, reverse=False)
networkit.algebraic.laplacianMatrix(G)

Get the laplacian matrix of the graph G.

G : Graph
The graph.
lap : ndarray
The N x N laplacian matrix of graph.
diag : ndarray
The length-N diagonal of the laplacian matrix. diag is returned only if return_diag is True.
networkit.algebraic.symmetricEigenvectors(matrix, cutoff=-1, reverse=False)

Computes eigenvectors and -values of symmetric matrices.

matrix : sparse matrix
The matrix to compute the eigenvectors of
cutoff : int
The maximum (or minimum) magnitude of the eigenvectors needed
reverse : boolean
If set to true, the smaller eigenvalues will be computed before the larger ones
pr : ( [ float ], [ ndarray ] )
A tuple of ordered lists, the first containing the eigenvalues in descending (ascending) magnitude, the second one holding the corresponding eigenvectors