Linear algebra#

Graph Matrix#

Adjacency matrix and incidence matrix of graphs.

adjacency_matrix(G[, nodelist, dtype, weight])

Returns adjacency matrix of G.

incidence_matrix(G[, nodelist, edgelist, ...])

Returns incidence matrix of G.

Laplacian Matrix#

Laplacian matrix of graphs.

All calculations here are done using the out-degree. For Laplacians using in-degree, use G.reverse(copy=False) instead of G and take the transpose.

The laplacian_matrix function provides an unnormalized matrix, while normalized_laplacian_matrix, directed_laplacian_matrix, and directed_combinatorial_laplacian_matrix are all normalized.

laplacian_matrix(G[, nodelist, weight])

Returns the Laplacian matrix of G.

normalized_laplacian_matrix(G[, nodelist, ...])

Returns the normalized Laplacian matrix of G.

directed_laplacian_matrix(G[, nodelist, ...])

Returns the directed Laplacian matrix of G.

directed_combinatorial_laplacian_matrix(G[, ...])

Return the directed combinatorial Laplacian matrix of G.

total_spanning_tree_weight(G[, weight, root])

Returns the total weight of all spanning trees of G.

Bethe Hessian Matrix#

Bethe Hessian or deformed Laplacian matrix of graphs.

bethe_hessian_matrix(G[, r, nodelist])

Returns the Bethe Hessian matrix of G.

Algebraic Connectivity#

Algebraic connectivity and Fiedler vectors of undirected graphs.

algebraic_connectivity(G[, weight, ...])

Returns the algebraic connectivity of an undirected graph.

fiedler_vector(G[, weight, normalized, tol, ...])

Returns the Fiedler vector of a connected undirected graph.

spectral_ordering(G[, weight, normalized, ...])

Compute the spectral_ordering of a graph.

spectral_bisection(G[, weight, normalized, ...])

Bisect the graph using the Fiedler vector.

Attribute Matrices#

Functions for constructing matrix-like objects from graph attributes.

attr_matrix(G[, edge_attr, node_attr, ...])

Returns the attribute matrix using attributes from G as a numpy array.

attr_sparse_matrix(G[, edge_attr, ...])

Returns a SciPy sparse array using attributes from G.

Modularity Matrices#

Modularity matrix of graphs.

modularity_matrix(G[, nodelist, weight])

Returns the modularity matrix of G.

directed_modularity_matrix(G[, nodelist, weight])

Returns the directed modularity matrix of G.

Spectrum#

Eigenvalue spectrum of graphs.

adjacency_spectrum(G[, weight])

Returns eigenvalues of the adjacency matrix of G.

laplacian_spectrum(G[, weight])

Returns eigenvalues of the Laplacian of G

bethe_hessian_spectrum(G[, r])

Returns eigenvalues of the Bethe Hessian matrix of G.

normalized_laplacian_spectrum(G[, weight])

Return eigenvalues of the normalized Laplacian of G

modularity_spectrum(G)

Returns eigenvalues of the modularity matrix of G.