Best way to turn for_each_handle into a generator instead of an internal iterator
Opened this issue · 3 comments
JervenBolleman commented
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 commented
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 commented
This approach works for node handles. Unfortunately it will not work for path_handle
s. As there is no easy way to get a set of path_handle
s. This either means loading a set of them on open, or figuring out how to do this.
JervenBolleman commented
I opened an issue at libhandlegraph