[Lemon-commits] [lemon_svn] alpar: r946 - hugo/trunk/src/hugo

Lemon SVN svn at lemon.cs.elte.hu
Mon Nov 6 20:42:22 CET 2006


Author: alpar
Date: Tue Jul  6 13:27:36 2004
New Revision: 946

Modified:
   hugo/trunk/src/hugo/list_graph.h

Log:
- Bugfix in erase()
- reserveEdge() added


Modified: hugo/trunk/src/hugo/list_graph.h
==============================================================================
--- hugo/trunk/src/hugo/list_graph.h	(original)
+++ hugo/trunk/src/hugo/list_graph.h	Tue Jul  6 13:27:36 2004
@@ -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;



More information about the Lemon-commits mailing list