networkx icon indicating copy to clipboard operation
networkx copied to clipboard

Enhancement issue 3657

Open cshjin opened this issue 4 years ago • 2 comments

Contributions:

  • Update the API for the Laplacian matrix and its spectrum with the new argument signless, which indicates to use the L = D+A.
    • enhancement issue #3657
    • For other functions directed_laplacian_matrix and directed_combinatorial_laplacian_matrix, I cannot find the reference for the signless version. So just keep them as they are.
  • Add normalized adjacency and normalized Laplacian matrices.
    • enhancement issue #3834
    • updated doc and test cases

file changes

  • add normalized_adjacency_spectrum in networkx/linalg/spectrum.py
  • add normalized_laplacian_matrix in networkx/linalg/laplacianmatrix.py
  • laplacian_spectrum and normalized_adjacency_spectrum in networkx/linalg/spectrum.py
  • laplacian_matrix and normalized_laplacian_matrix in networkx/linalg/laplacianmatrix.py
  • update tests in networkx/linalg/tests/test_graphmatrix.py and networkx/linalg/tests/test_normalized_laplacian_spectrum.py
  • format graphmatrix.py with black style

Feel free to close deprecated PR (#3835). Duplicated PR was closed(#3836).

cshjin avatar Jan 25 '21 01:01 cshjin

Sorry this never got a look @cshjin . I just took a quick look now and my initial reaction is that I think it might be better to add examples of how to compute these quantities from the existing functions rather than add dedicated functions. For example, instead of adding a normalized_adjacency_matrix function, the few lines that it takes to compute the normalized adjacency matrix (given the adjacency matrix) could be added as a docstring example.

This has the advantage of demonstrating to users how the existing tools can be used to compute other interesting quantities without having to add to the API. OTOH I'm not an expert in this area and have no sense of just how often the normalization is.

rossbar avatar Jun 28 '22 15:06 rossbar

This PR actually looks useful to me. I'm not aware of the complete literature, but in graph neural networks and graph signal processing, the signless Laplacian matrix and the normalised adjacency matrix are being used.

For what it's worth, the signless Laplacian is mentioned on Wikipedia; https://en.wikipedia.org/wiki/Laplacian_matrix#Signless_Laplacian and there are thousands of papers with the keyword "normalized adjacency matrix": https://scholar.google.com/scholar?q="normalized+adjacency+matrix"

ghost avatar Oct 05 '23 13:10 ghost