pnnl / HyperNetX

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

No edge or node properties in static hypergraphs #77

Closed michaeldorner closed 2 years ago

michaeldorner commented 2 years ago

I would like to store some edge properties. For hypernetx > 1.1 this should work.

For

H = hnx.Hypergraph()
H.add_edge(hnx.Entity('e1', {1, 2}, p='a property'))
H.edges['e1'].properties['p'] # returns 'a property'

I get what I expect. But for static hypergraphs, there are no properties:

H_static = H.convert_to_static(name='static')
H_static.edges.props # return {}

Am I doing something wrong?

brendapraggastis commented 2 years ago

@michaeldorner No you aren't doing anything wrong. We are still working out the best data type for StaticEntities. The idea was to lift the burden of instantiating every edge and node as an entity by storing all the information in a single dataframe. Right now H.edges ['e1'] returns a UserList so here is one way to add properties:

H = H.convert_to_static(name='static')
H.edges['e1'].properties = dict(p='a property')
H.edges['e1'].properties
## output: {'p': 'a property'}

This isn't a permanent solution. We hope v2.0 will drop the discrepancies between static True and False so that it is more user friendly.

Keep sending issues our way. We would love to hear how you are using the library!! Brenda @brendapraggastis