# HG changeset patch # User alpar # Date 1089113256 0 # Node ID 887c551fb0aa93d1bd20172aec5280485c65a39c # Parent 2d87cefb35b22f6e5ec4946b7794229ea41ea5e9 - Bugfix in erase() - reserveEdge() added diff -r 2d87cefb35b2 -r 887c551fb0aa src/hugo/list_graph.h --- a/src/hugo/list_graph.h Tue Jul 06 10:07:48 2004 +0000 +++ b/src/hugo/list_graph.h Tue Jul 06 11:27:36 2004 +0000 @@ -114,6 +114,13 @@ int nodeNum() const { return nodes.size(); } //FIXME: What is this? int edgeNum() const { return edges.size(); } //FIXME: What is this? + ///Set the expected number of edges + + ///With this function, it is possible to set the expected number of edges. + ///The use of this fasten the building of the graph and makes + ///it possible to avoid the superfluous memory allocation. + void reserveEdge(int n) { edges.reserve(n); }; + ///\bug This function does something different than ///its name would suggests... int maxNodeId() const { return nodes.size(); } //FIXME: What is this? @@ -260,7 +267,7 @@ else nodes[edges[n].tail].first_out = edges[n].next_out; edges[n].next_in = first_free_edge; - first_free_edge = -1; + first_free_edge = n; //Update dynamic maps Edge e; e.n=n;