xgi-org / xgi

CompleX Group Interactions (XGI) is a Python package for higher-order networks.
https://xgi.readthedocs.io
Other
171 stars 27 forks source link

weighted projection of hypergraphs #534

Open Liyubov opened 2 months ago

Liyubov commented 2 months ago

We have been discussing this with Nicholas briefly. @nwlandry

At the moment there is one way to make the projection of the hypergraph:

https://xgi.readthedocs.io/en/stable/_modules/xgi/convert/graph.html

But when you want to really compare some higher-order properties of hypergraphs (even paths properties), you will need to look and make some weighted projections of hypergraphs. There are some algorithms available for this, and I am happy to help with implementing them or discussing if you think this is something which can already be derived from your existing functionalities :)

nwlandry commented 2 months ago

Thanks for this comment, @Liyubov! We have a few options for weighted matrices (See the linalg section). It looks like NetworkX can convert weighted matrices to graphs with a weight attribute --- is this what you were picturing? If you have an idea for the particular matrix (The clique motif matrix, for example) we can easily add the option to output this as a weighted graph. Great idea and thanks for the suggestion!

Liyubov commented 2 months ago

@nwlandry I was thinking of not going through networkx, as if you go through networkx then it is essentially becomes not the higher-order feature anymore, but feature of the projection.

the linalg section is great, and using it we can generated the initialy non-projected version using operations on tensor, we try to develop similar things here when we load and associate the tensor to the hypergraph and then make all operations with it...

https://github.com/Liyubov/hypergraph_structures/blob/main/code%20notebooks/hyper_graph_motif_counting_rewriting_numpy_ipynb_txt.ipynb

the difficulty with this approach is that it is actually then slow in python. so python may not be best?