Skip to content

GraphFromCoo triggers missing numpy dtype 'ulong' #1368

@castagninojose

Description

@castagninojose

Description

I was trying to create a nk.Graph using a scipy coo_matrix and encountered the following issue.

Numpy complaints that there's no np.ulong.

A quick google search showed me that this type was indeed removed as of numpy 1.25.

I tried replacing np.ulong with np.ulonglong (which is available for my version of numpy) in the graph.pyx file, but the issue persists, so probably other places require updating too, or even something else entirely. It may be that this is an easy fix, but I was unable to find other references to 'ulong'.


Reproducing

Should be straightforward; running the following

import networkit as nk
import scipy.sparse as sp
A = sp.coo_matrix([[1, 0, 0], [0, 1, 0], [0, 0, 1]])
nk.graph.GraphFromCoo(A)

raises the error

File /usr/local/lib/python3.11/dist-packages/networkit/graph.pyx:1192, in networkit.graph.GraphFromCoo()

File /usr/local/lib/python3.11/dist-packages/networkit/graph.pyx:460, in networkit.graph.Graph.addEdges()

File /usr/local/lib/python3.11/dist-packages/numpy/__init__.py:333, in __getattr__(attr)
    330     "Removed in NumPy 1.25.0"
    331     raise RuntimeError("Tester was removed in NumPy 1.25.")
--> 333 raise AttributeError("module {!r} has no attribute "
    334                      "{!r}".format(__name__, attr))

AttributeError: module 'numpy' has no attribute 'ulong'

Environment info

  • Python: 3.11.0
  • Numpy: 1.26.4
  • NetworKit: 11.1.post1

My apologies in advance if this case was already considered/documented.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions