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

Best way to turn for_each_handle into a generator instead of an internal iterator #4

Open
JervenBolleman opened this issue Oct 22, 2019 · 3 comments
Labels
help wanted Extra attention is needed

Comments

@JervenBolleman
Copy link
Collaborator

for_each_handle and for_each_path are the two key methods that need efficient implementation.
However, these are C++ internal iterators while the librdf would like to see a generator.

I would love to see some help on how to best convert from the one into the other.

@JervenBolleman
Copy link
Collaborator Author

For now we can just do a loop in a range

def nodes:
  nodeId = og.min_node_id
  maxNodeId = og.max_node_id
  while (nodeId <= maxNodeId):
    if(og.has_node(nodeId):
      yield og.get_node(nodeId)
      nodeId+1

But this will cost in efficiency and long run needs to be fixed.

@JervenBolleman JervenBolleman added optimization help wanted Extra attention is needed and removed optimization labels Oct 23, 2019
@JervenBolleman
Copy link
Collaborator Author

This approach works for node handles. Unfortunately it will not work for path_handles. As there is no easy way to get a set of path_handles. This either means loading a set of them on open, or figuring out how to do this.

@JervenBolleman
Copy link
Collaborator Author

I opened an issue at libhandlegraph

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant