Graph Isomorphism with VertexPropertyMap of type long
Bug reports:
Informations
- graph-tool version: 2.31 (commit 8561bac9, Fri Mar 27 23:59:57 2020 +0100)
- System: Debian 10 / 5.4.0-0.bpo.4-amd64 / Python version 3.7.3
Bug description
I want to compute an isomorphism between two graph using an invariant.
This does not work if the type of the VertexPropertyMap
is long (while it works for int or bool).
Reproducible example (may not be minimal)
import graph_tool
# Create g
g: graph_tool.Graph = graph_tool.Graph()
g.add_vertex(3)
g.vp.prop_int = g.new_vertex_property('int')
g.vp.prop_long = g.new_vertex_property('long')
g.vp.prop_int.get_array()[:] = [3, 1, 2]
g.vp.prop_long.get_array()[:] = [2**32, 2**32-1, 2**32-5]
g.add_edge_list([(0, 1), (1, 2)])
# Create g2
g2: graph_tool.Graph = graph_tool.Graph()
g2.add_vertex(3)
g2.vp.prop_int = g2.new_vertex_property('int')
g2.vp.prop_long = g2.new_vertex_property('long')
g2.vp.prop_int.get_array()[:] = [3, 1, 2]
g2.vp.prop_long.get_array()[:] = [2**32, 2**32-1, 2**32-5]
g2.add_edge_list([(0, 1), (1, 2)])
# Works as expected
graph_tool.topology.isomorphism(g, g2, vertex_inv1=g.vp.prop_int, vertex_inv2=g2.vp.prop_int)
# This fails:
graph_tool.topology.isomorphism(g, g2, vertex_inv1=g.vp.prop_long, vertex_inv2=g2.vp.prop_long)
Python error
MemoryError Traceback (most recent call last)
<ipython-input-34-0535769d768c> in <module>
----> 1 graph_tool.topology.isomorphism(g1, g2, vertex_inv1=g1.vp.prop_long, vertex_inv2=g2.vp.prop_long)
/usr/lib/python3/dist-packages/graph_tool/topology/__init__.py in isomorphism(g1, g2, vertex_inv1, vertex_inv2, isomap)
624 _prop("v", g2, vertex_inv2),
625 inv_max,
--> 626 _prop("v", g1, imap))
627 if isomap:
628 return iso, imap
MemoryError: