Package networkx :: Module spectrum
[hide private]
[frames] | no frames]

Module spectrum

source code

Laplacian, adjacency matrix, and spectrum of graphs.

Needs numpy array package: numpy.scipy.org.




Author: Aric Hagberg (hagberg@lanl.gov) Pieter Swart (swart@lanl.gov) Dan Schult(dschult@colgate.edu)

Functions [hide private]
 
adj_matrix(G, nodelist=None)
Return adjacency matrix of graph as a numpy matrix.
source code
 
laplacian(G, nodelist=None)
Return standard combinatorial Laplacian of G as a numpy matrix.
source code
 
normalized_laplacian(G, nodelist=None)
Return normalized Laplacian of G as a numpy matrix.
source code
 
laplacian_spectrum(G)
Return eigenvalues of the Laplacian of G
source code
 
adjacency_spectrum(G)
Return eigenvalues of the adjacency matrix of G
source code
 
combinatorial_laplacian(G, nodelist=None)
Return standard combinatorial Laplacian of G as a numpy matrix.
source code
 
generalized_laplacian(G, nodelist=None)
Return normalized Laplacian of G as a numpy matrix.
source code
 
_test_suite() source code
Function Details [hide private]

adj_matrix(G, nodelist=None)

source code 

Return adjacency matrix of graph as a numpy matrix.

This just calls networkx.convert.to_numpy_matrix.

If you want a pure python adjacency matrix represntation try networkx.convert.to_dict_of_dicts with weighted=False, which will return a dictionary-of-dictionaries format that can be addressed as a sparse matrix.

laplacian(G, nodelist=None)

source code 

Return standard combinatorial Laplacian of G as a numpy matrix.

Return the matrix L = D - A, where

D is the diagonal matrix in which the i'th entry is the degree of node i A is the adjacency matrix.

normalized_laplacian(G, nodelist=None)

source code 

Return normalized Laplacian of G as a numpy matrix.

See Spectral Graph Theory by Fan Chung-Graham. CBMS Regional Conference Series in Mathematics, Number 92, 1997.

combinatorial_laplacian(G, nodelist=None)

source code 

Return standard combinatorial Laplacian of G as a numpy matrix.

Return the matrix L = D - A, where

D is the diagonal matrix in which the i'th entry is the degree of node i A is the adjacency matrix.

generalized_laplacian(G, nodelist=None)

source code 

Return normalized Laplacian of G as a numpy matrix.

See Spectral Graph Theory by Fan Chung-Graham. CBMS Regional Conference Series in Mathematics, Number 92, 1997.