-
Notifications
You must be signed in to change notification settings - Fork 188
Closed
Labels
bugSomething isn't workingSomething isn't working
Milestone
Description
Information
- retworkx version: main branch (since 71e34d1)
- Python version: 3.10
- Rust version: 1.60
- Operating system: Linux
What is the current behavior?
Trying to create a numpy array from an EdgeList
object fails
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'retworkx.EdgeList'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/tmp/test_failure.py", line 5, in <module>
print(np.asarray(res, dtype=np.uintp))
ValueError: setting an array element with a sequence.
I bisected this to 71e34d1 (#569). I'm not sure if this is caused by changes in the newer version of pyo3 or our minimal changes to the custom_vec_iter_impl
macro (I'm leaning towards a pyo3 change).
What is the expected behavior?
calling np.asarray(g.edge_list, dtype=np.uintp)
will create a numpy array for the edge list like:
[[0 1]
[0 2]
[0 3]
[0 4]]
Steps to reproduce the problem
import retworkx
import numpy as np
g = retworkx.generators.directed_star_graph(5)
res = g.edge_list()
print(np.asarray(res, dtype=np.uintp))
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working