Warning

This documents an unmaintained version of NetworkX. Please upgrade to a maintained version and see the current NetworkX documentation.

Linear algebra

Graph Matrix

Adjacency matrix and incidence matrix of graphs.

adjacency_matrix(G[, nodelist, weight]) Return adjacency matrix of G.
incidence_matrix(G[, nodelist, edgelist, …]) Return incidence matrix of G.

Laplacian Matrix

Laplacian matrix of graphs.

laplacian_matrix(G[, nodelist, weight]) Return the Laplacian matrix of G.
normalized_laplacian_matrix(G[, nodelist, …]) Return the normalized Laplacian matrix of G.
directed_laplacian_matrix(G[, nodelist, …]) Return the directed Laplacian matrix of G.

Spectrum

Eigenvalue spectrum of graphs.

laplacian_spectrum(G[, weight]) Return eigenvalues of the Laplacian of G
adjacency_spectrum(G[, weight]) Return eigenvalues of the adjacency matrix of G.

Algebraic Connectivity

Algebraic connectivity and Fiedler vectors of undirected graphs.

algebraic_connectivity(G[, weight, …]) Return the algebraic connectivity of an undirected graph.
fiedler_vector(G[, weight, normalized, tol, …]) Return the Fiedler vector of a connected undirected graph.
spectral_ordering(G[, weight, normalized, …]) Compute the spectral_ordering of a graph.

Attribute Matrices

Functions for constructing matrix-like objects from graph attributes.

attr_matrix(G[, edge_attr, node_attr, …]) Returns a NumPy matrix using attributes from G.
attr_sparse_matrix(G[, edge_attr, …]) Returns a SciPy sparse matrix using attributes from G.