sgtl.spectrum.laplacian_spectrum#

sgtl.spectrum.laplacian_spectrum(graph: Graph, num_eigenvalues=None, magnitude='smallest', plot=False) List[complex]#

Return a list of the eigenvalues of the laplacian matrix of the given graph.

Computing all of the eigenvalues of the laplacian matrix is an expensive operation. You should set num_eigenvalues to control the number of eigenvalues you would like to compute.

When computing only a subset of the eigenvalues, the ‘magnitude’ parameter controls whether the eigenvalues with largest or smallest magnitude will be returned. This defaults to ‘smallest’.

If the plot argument is true, then the spectrum is plotted using matplotlib before being returned.

Parameters:
  • graph – The SGTL graph object on which to operate.

  • num_eigenvalues – How many eigenvalues to return.

  • magnitude – Should be ‘smallest’ or ‘largest’ - whether to return the eigenvalues with smallest or largest magnitude.

  • plot – Whether to plot the spectrum before returning it