Skip to content

How to transform a igraph or networkx object into hypergraph? #29

Description

@wanglu2014

How to transform a igraph or networkx object into hypergraph object used in DHG?

Activity

  1. yifanfeng97 commented on Feb 15, 2023

    @yifanfeng97
    Member

    Hi, you can extract the edge list and the number of vertices from G of networkx. Then, you can construct a DHG's Graph with the default construction function https://deephypergraph.readthedocs.io/en/0.9.3/api/dhg.html#dhg.Graph .
    We will add the transform function of structures from igraph and networkx libraries in the next version. ^^

  2. wanglu2014 commented on Feb 16, 2023

    @wanglu2014
    Author

    Thank you for your timely reply. Could you kindly suggest how to set node attribute?

  3. yifanfeng97 commented on Feb 17, 2023

    @yifanfeng97
    Member

    If you don't have the node attribute, you can try the following ways:

    1. initialize the vertex feature with the normal distribution and set it as trainable parameters. (Common in recommender system)
    2. initialize the vertex feature with the normal distribution.
    3. initialize the vertex feature with a one-hot encoded vector. (you can encode the degree of each vertex or directly use a identity matrix as the vertex feature)
    4. train a auto encoder: the input is the adjacency matrix A and the output is the same. initialize the vertex feature with the hidden embeddings.
  4. wanglu2014 commented on Feb 17, 2023

    @wanglu2014
    Author

    Thanks. If I want to set a numeric vector (degree) as node attribute. How to assign the numbers to nodes?

  5. yifanfeng97 commented on Feb 20, 2023

    @yifanfeng97
    Member

    You can try to transform the degree to a one-hot vector. Refer to this https://github.com/weihua916/powerful-gnns/blob/master/util.py#L118

  6. colltoaction commented on Oct 29, 2024

    @colltoaction

    Hi @yifanfeng97 I wonder what encoding of Hypergraphs you would use in NetworkX transformations. I'm implementing such encoding and was hoping to use this one:

    What do you think? Thanks!

  7. colltoaction commented on Dec 30, 2024

    @colltoaction

    Hi again! I would like to invite you to join the HIF effort, allowing hypergraphs to be shared across many libraries. This can complement the pickle strategy that is currently implemented with cross library and language compatibility.

    I hope you would like to take a look at our repository where we provide the specification of a JSON format. It is an incidence-based encoding that looks to be compatible with the structure of your library. This format has been implemented in HypergraphX, HyperNetX and XGI.

    https://github.com/pszufe/HIF-standard

    Let me know what you think and any way I can help make this happen!

    Cheers and happy new year.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions