numpy int64 cannot be used for indexing VertexSeq
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
igraph |
Fix Committed
|
Medium
|
Tamás Nepusz |
Bug Description
Though there is no reference to numpy in the igraph docs, it is common to use numpy with python-igraph. The integer type returned by many numpy functions on 64 bit systems is numpy.int64. When such numbers are used for indexing a VertexSeq in igraph, the error:
KeyError: 'Attribute does not exist'
appears. This causes hard-to-track bugs in the python script. Common use case is,
g = igraph.Graph()
# Add some vertices and edges to g
sp = g.shortest_paths()
# Now we want to find paths shorter than some cutoff
sources, targets = numpy.nonzero(
# Now we want to print some attributes of those vertices
for source_index, target_index in zip(sources, targets):
print g.vs[source_
Changed in igraph: | |
importance: | Undecided → Medium |
assignee: | nobody → Tamás Nepusz (ntamas) |
status: | New → Confirmed |
milestone: | none → 0.7 |
Fixed in https:/ /github. com/igraph/ igraph/ commit/ b0f66975ce21513 6a6e8b90c186795 a43cf4443a