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

Better way of getting node and edge data #20

Closed
nwlandry opened this issue Dec 8, 2021 · 2 comments
Closed

Better way of getting node and edge data #20

nwlandry opened this issue Dec 8, 2021 · 2 comments
Assignees
Labels
improve Make an existing feature better

Comments

@nwlandry
Copy link
Collaborator

nwlandry commented Dec 8, 2021

Currently the way of accessing nodal data of node 1 is H.nodes.data()[1] or H.nodes(1).data() and a more streamlined call would be preferable. Currently .nodes(id) and .nodes[id] access a node's bipartite neighbors so this probably is an undesirable way of doing it. The problem is that unlike NetworkX, we are using two dictionaries each for nodes and edges: one for nodes and one for attributes. So, I'm not sure what the function would return. I see three options 1) a separate property of Hypergraph called H.node_data or something 2) a flag data where if data=True, then it returns the node attributes and if false, it returns the nodes with the bipartite connections, or 3) return a tuple of the bipartite connections and data respectively. Would appreciate your thoughts!

@nwlandry nwlandry added the improve Make an existing feature better label Dec 8, 2021
@leotrs
Copy link
Collaborator

leotrs commented Dec 9, 2021

I highly prefer a single way of doing things, so I would add to this issue that among the two calls

H.nodes.data()[1]
H.nodes(1).data()

we choose one and remove the other. If we implement something entirely new, then I would suggest keeping the new one and removing these two (if possible).

  1. a flag data where if data=True, then it returns the node attributes and if false, it returns the nodes with the bipartite connections
  2. return a tuple of the bipartite connections and data respectively.

If I understood correctly, these two suggestion propose to return both the neighbors and the data at the same time. I think this may be a bit confusing, so I would vote for suggestion 1).

This was referenced Jan 20, 2022
@leotrs
Copy link
Collaborator

leotrs commented Feb 16, 2022

We can currently get the node and edge data via H.nodes[0] and H.edges[0].

@leotrs leotrs closed this as completed Feb 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improve Make an existing feature better
Projects
None yet
Development

No branches or pull requests

2 participants