Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSRMatrix::laplacianMatrix wrong results for self-loops #1120

Open
bernlu opened this issue Aug 23, 2023 · 1 comment
Open

CSRMatrix::laplacianMatrix wrong results for self-loops #1120

bernlu opened this issue Aug 23, 2023 · 1 comment
Labels

Comments

@bernlu
Copy link
Contributor

bernlu commented Aug 23, 2023

The laplacian matrix computed by CSRMatrix::laplacianMatrix is wrong when the graph contains self-loops.

Example:

    Graph G(2);
    G.addEdge(0, 1);
    G.addEdge(1, 1);

    std::cout << CSRMatrix::laplacianMatrix(G) << std::endl;
    // 1, -1,
    // -1, -1,

I am not 100% sure what the expected result is, but in any case it is not -1 on the diagonal.

@bernlu bernlu added the bug label Aug 23, 2023
@hmeyerhenke
Copy link

My suggestion: Test if there are self-loops. Exclude/ignore them. Document this in the code and tell the calling function that self-loops were ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants