Commit f87c1e11 authored by Tiago Peixoto's avatar Tiago Peixoto
Browse files

Improve speed of Graph.remove_vertex()

parent 1b6f5ae1
...@@ -125,7 +125,7 @@ struct reindex_vertex_property ...@@ -125,7 +125,7 @@ struct reindex_vertex_property
void GraphInterface::ReIndexVertexProperty(boost::any map, void GraphInterface::ReIndexVertexProperty(boost::any map,
boost::any aold_index) const boost::any aold_index) const
{ {
typedef property_map_type::apply<int32_t, typedef property_map_type::apply<int64_t,
GraphInterface::vertex_index_map_t>::type GraphInterface::vertex_index_map_t>::type
index_prop_t; index_prop_t;
index_prop_t old_index = any_cast<index_prop_t>(aold_index); index_prop_t old_index = any_cast<index_prop_t>(aold_index);
......
...@@ -1454,9 +1454,7 @@ class Graph(object): ...@@ -1454,9 +1454,7 @@ class Graph(object):
self.__check_perms("del_vertex") self.__check_perms("del_vertex")
vertex = self.vertex(int(vertex)) vertex = self.vertex(int(vertex))
index = self.vertex_index[vertex] index = self.vertex_index[vertex]
back = self.__graph.GetNumberOfVertices(False) - 1
u = GraphView(self, skip_properties=True, skip_vfilt=True)
back = u.num_vertices() - 1
# move / shift all known property maps # move / shift all known property maps
if index != back: if index != back:
...@@ -2114,7 +2112,7 @@ class Graph(object): ...@@ -2114,7 +2112,7 @@ class Graph(object):
""" """
if in_place: if in_place:
old_indexes = self.vertex_index.copy("int32_t") old_indexes = self.vertex_index.copy("int64_t")
self.__graph.PurgeVertices(_prop("v", self, old_indexes)) self.__graph.PurgeVertices(_prop("v", self, old_indexes))
self.set_vertex_filter(None) self.set_vertex_filter(None)
for pmap in self.__known_properties.values(): for pmap in self.__known_properties.values():
......
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