pnnl / HyperNetX

Python package for hypergraph analysis and visualization.
https://hypernetx.readthedocs.io
Other
536 stars 92 forks source link

add_edge and add_node_to_edge not included in Hypergraph class #113

Closed LucaGherardini closed 1 month ago

LucaGherardini commented 1 year ago

Hello, I am trying to manually add edges to a hypergraph 'H'. First, I tried H.edges.add(), but it didn't show it in the edges list. I then read the documentation and in entity.py it says to use Hypergraph.add_edge or Hypergraph.add_node_to_edge instead, but none of the two is defined in the Hypergraph class, so they are not callable by H. Am I missing something?

LucaGherardini commented 1 year ago

P.S.: The only invocation I found in the repository was in hypernetx/classes/tests/test_hypergraph.py, others were only comments. In this test, it says (line 65)

"Deprecated method; will support in later release"

And, except the fact that deprecated and future release are somewhat opposite to each other, I don't understand why it has been kept in the documentation of the methods, and why a currently way of adding nodes is not available.

bpraggastis commented 1 year ago

@LucaGherardini You are correct, kind of a silly sentence. The add functionality is on our list for July. Please stay tuned.

markwgirard commented 10 months ago

@LucaGherardini You are correct, kind of a silly sentence. The add functionality is on our list for July. Please stay tuned.

What's the status on the add_edge functionality?

brendapraggastis commented 10 months ago

@markwgirard @LucaGherardini We are still working on the new release with the add_edge functionality. There were a number of bugs in the 2.0 version that are gradually being repaired and updated as hot fixes. Once the data structures introduced in 2.0 are stable, we will add in the add/remove functionality. Keep watch, we hope to have it within a month or two. Thanks for your patience.

yb-hitsz commented 7 months ago

@markwgirard @LucaGherardini We are still working on the new release with the add_edge functionality. There were a number of bugs in the 2.0 version that are gradually being repaired and updated as hot fixes. Once the data structures introduced in 2.0 are stable, we will add in the add/remove functionality. Keep watch, we hope to have it within a month or two. Thanks for your patience.

Any updates on this add_edge function?

dtchang commented 3 months ago

add_nodes_to_edges(edge_dict, inplace=True) has modify / add_new semantics, depending on whether edge_id in edge_dict already exists or not.

We need a method with add_new semantics such that if edge_id already exists, it will be assigned a new one.

brendapraggastis commented 1 month ago

@dtchang Our decision was to use existing names first and only create a new object if it doesn't already exist. You can check if an id is in use or use rename to rename the nodes and edges using the Hypergraph.rename method