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

multiorder laplacian #16

Open
federicomalizia opened this issue Aug 28, 2023 · 1 comment
Open

multiorder laplacian #16

federicomalizia opened this issue Aug 28, 2023 · 1 comment

Comments

@federicomalizia
Copy link

federicomalizia commented Aug 28, 2023

hi,

I'm considering a "real" hypergraph, while computing the laplacians of any order I found this error:

 
      9 hypergraph = Hypergraph(hyperedges_list)
---> 10 laplacians = laplacian_matrices_all_orders(hypergraph)
     11 
     12 

~/anaconda3/lib/python3.9/site-packages/hypergraphx/linalg/linalg.py in laplacian_matrices_all_orders(hypergraph, weighted, shape)
    422     laplacian_matrices = {}
    423     for order in range(1, hypergraph.max_order() + 1):
--> 424         laplacian_matrices[order] = laplacian_matrix_by_order(
    425             hypergraph, order, weighted, shape
    426         )

~/anaconda3/lib/python3.9/site-packages/hypergraphx/linalg/linalg.py in laplacian_matrix_by_order(hypergraph, order, weighted, shape)
    407 
    408     #maybe wrong mapping of nodes? binary incidence returns the mapping of the nodes in the hypergraph
--> 409     degree_mtx = degree_matrix(hypergraph, order, mapping)
    410     laplacian = degree_mtx.multiply(order + 1) - incidence.dot(incidence.transpose())
    411 

~/anaconda3/lib/python3.9/site-packages/hypergraphx/linalg/linalg.py in degree_matrix(hypergraph, order, mapping)
    393         # calcolare il mapping dall'ipergrafo
    394         pass
--> 395     degree_lst = [degree_dct[inverse_mapping[n]] for n in sorted(inverse_mapping.keys())]
    396 
    397     return sparse.diags(degree_lst)

~/anaconda3/lib/python3.9/site-packages/hypergraphx/linalg/linalg.py in <listcomp>(.0)
    393         # calcolare il mapping dall'ipergrafo
    394         pass
--> 395     degree_lst = [degree_dct[inverse_mapping[n]] for n in sorted(inverse_mapping.keys())]
    396 
    397     return sparse.diags(degree_lst)

KeyError: 0

I think it is due to the presence of nodes which are not connected to any hyperedge of order 2 (triples).

@FraLotito
Copy link
Contributor

Hi! Thank you for reporting this error, we are currently investigating.

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

No branches or pull requests

2 participants