- Bugfix in erase()
authoralpar
Tue, 06 Jul 2004 11:27:36 +0000
changeset 695887c551fb0aa
parent 694 2d87cefb35b2
child 696 48aa9ace1d7d
- Bugfix in erase()
- reserveEdge() added
src/hugo/list_graph.h
     1.1 --- a/src/hugo/list_graph.h	Tue Jul 06 10:07:48 2004 +0000
     1.2 +++ b/src/hugo/list_graph.h	Tue Jul 06 11:27:36 2004 +0000
     1.3 @@ -114,6 +114,13 @@
     1.4      int nodeNum() const { return nodes.size(); }  //FIXME: What is this?
     1.5      int edgeNum() const { return edges.size(); }  //FIXME: What is this?
     1.6  
     1.7 +    ///Set the expected number of edges
     1.8 +
     1.9 +    ///With this function, it is possible to set the expected number of edges.
    1.10 +    ///The use of this fasten the building of the graph and makes
    1.11 +    ///it possible to avoid the superfluous memory allocation.
    1.12 +    void reserveEdge(int n) { edges.reserve(n); };
    1.13 +    
    1.14      ///\bug This function does something different than
    1.15      ///its name would suggests...
    1.16      int maxNodeId() const { return nodes.size(); }  //FIXME: What is this?
    1.17 @@ -260,7 +267,7 @@
    1.18        else nodes[edges[n].tail].first_out = edges[n].next_out;
    1.19        
    1.20        edges[n].next_in = first_free_edge;
    1.21 -      first_free_edge = -1;      
    1.22 +      first_free_edge = n;      
    1.23  
    1.24        //Update dynamic maps
    1.25        Edge e; e.n=n;