Commit 2baba488 authored by Tiago Peixoto's avatar Tiago Peixoto
Browse files

Fix bug in PropertyMap.get_array() for edge properties

The reserved size for the array was set to g.num_edges(), but it should
be set to the maximum edge index + 1, since some edges might have been
deleted.
parent ad9dbc5e
......@@ -366,6 +366,7 @@ BOOST_PYTHON_MODULE(libgraph_tool_core)
.def("ClearEdges", &GraphInterface::ClearEdges)
.def("GetVertexIndex", &GraphInterface::GetVertexIndex)
.def("GetEdgeIndex", &GraphInterface::GetEdgeIndex)
.def("GetMaxEdgeIndex", &GraphInterface::GetMaxEdgeIndex)
.def("GetGraphIndex", &GraphInterface::GetGraphIndex)
.def("CopyVertexProperty", &GraphInterface::CopyVertexProperty)
.def("CopyEdgeProperty", &GraphInterface::CopyEdgeProperty);
......
......@@ -185,7 +185,7 @@ class PropertyMap(object):
if self.__key_type == 'v':
n = self.__g().num_vertices()
elif self.__key_type == 'e':
n = self.__g().num_edges()
n = self.__g()._Graph__graph.GetMaxEdgeIndex() + 1
else:
n = 1
self.__g().pop_filter(edge=True, vertex=True)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment