rx.layers(dag,) return node creation input data, instead of expected index
What is the expected enhancement?
for working with layers (iterations, etc.), expected nodes indexes, but not data used for creation
it would be nice to have an extension of the functionality, because the reverse index lookup is not efficient
Yeah, I agree having the ability to work with indices would be nice. The layers() function was something we added for qiskit a long time ago and they were using the data payload so I didn't really think about it at the time. Working with indices would definitely be more natural. What do you think adding a parallel function like layer_indices to return a list of NodeIndices objects? Or did you have something else in mind?
In my feel of the solid way "layer_indices" is to harsh. Perhaps this would be a better option: layers(dag, first_layer, isIndexOutput = True) or layers(dag, first_layer, typeOutput = 1) as example
But a separate function is also good)
Ok sure, yeah I think having a kwarg for output type makes sense, the complexity comes from the the rust/python interface layer that likes things to be statically typed so it can generate the conversion code. I'll see what we can come up with, one trick is to convert to a python object in the function directly instead of relying on generated code to convert to a python object. Then we just return a python object and exactly what that is is determined by the function code.