Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Tiago Peixoto
graph-tool
Commits
83087948
Commit
83087948
authored
Aug 01, 2012
by
Tiago Peixoto
Browse files
Speed up removal of edges
An attempt no longer is made to reuse edge indexes in a contiguous fashion.
parent
edb9e873
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/graph/graph_python_interface.cc
View file @
83087948
...
...
@@ -231,26 +231,7 @@ void remove_edge(GraphInterface& gi, const python::object& e)
void
GraphInterface
::
RemoveEdgeIndex
(
const
edge_t
&
e
)
{
size_t
index
=
_edge_index
[
e
];
if
(
index
==
_state
->
_max_edge_index
)
{
if
(
_state
->
_max_edge_index
>
0
)
_state
->
_max_edge_index
--
;
while
(
!
_state
->
_free_indexes
.
empty
()
&&
_state
->
_max_edge_index
==
_state
->
_free_indexes
.
back
())
{
_state
->
_free_indexes
.
pop_back
();
if
(
_state
->
_max_edge_index
>
0
)
_state
->
_max_edge_index
--
;
}
}
else
{
typeof
(
_state
->
_free_indexes
.
begin
())
pos
=
lower_bound
(
_state
->
_free_indexes
.
begin
(),
_state
->
_free_indexes
.
end
(),
index
);
_state
->
_free_indexes
.
insert
(
pos
,
index
);
}
_state
->
_free_indexes
.
push_back
(
index
);
_state
->
_nedges
--
;
remove_edge
(
e
,
_state
->
_mg
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment