[Lemon-commits] [lemon_svn] alpar: r1937 - hugo/trunk/lemon

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


Author: alpar
Date: Thu Jun  9 11:47:51 2005
New Revision: 1937

Modified:
   hugo/trunk/lemon/list_graph.h
   hugo/trunk/lemon/smart_graph.h

Log:
Serious bugfix in ListGraph::SnapShot and SmartGraph::SnapShot

Modified: hugo/trunk/lemon/list_graph.h
==============================================================================
--- hugo/trunk/lemon/list_graph.h	(original)
+++ hugo/trunk/lemon/list_graph.h	Thu Jun  9 11:47:51 2005
@@ -457,6 +457,13 @@
 	exit(1);
       }
 
+      ///\bug What is this used for?
+      ///
+      virtual void build() {}
+      ///\bug What is this used for?
+      ///
+      virtual void clear() {}
+
       void regist(ListGraph &_g) {
 	g=&_g;
 	AlterationNotifier<Node>::ObserverBase::
@@ -517,13 +524,14 @@
     ///
     ///\todo This function might be called undo().
       void restore() {
+	ListGraph &old_g=*g;
 	deregist();
 	while(!added_edges.empty()) {
-	  g->erase(added_edges.front());
+	  old_g.erase(added_edges.front());
 	  added_edges.pop_front();
 	}
  	while(!added_nodes.empty()) {
-	  g->erase(added_nodes.front());
+	  old_g.erase(added_nodes.front());
 	  added_nodes.pop_front();
 	}
       }

Modified: hugo/trunk/lemon/smart_graph.h
==============================================================================
--- hugo/trunk/lemon/smart_graph.h	(original)
+++ hugo/trunk/lemon/smart_graph.h	Thu Jun  9 11:47:51 2005
@@ -280,14 +280,14 @@
   protected:
     void restoreSnapShot(const SnapShot &s)
     {
-      while(s.edge_num>edges.size()) {
+      while(s.edge_num<edges.size()) {
 	Parent::getNotifier(Edge()).erase(Edge(edges.size()-1));
 	nodes[edges.back().target].first_in=edges.back().next_in;
 	nodes[edges.back().source].first_out=edges.back().next_out;
 	edges.pop_back();
       }
       //nodes.resize(s.nodes_num);
-      while(s.node_num>nodes.size()) {
+      while(s.node_num<nodes.size()) {
 	Parent::getNotifier(Node()).erase(Node(nodes.size()-1));
 	nodes.pop_back();
       }



More information about the Lemon-commits mailing list