| ... | ... | 
		@@ -709,50 +709,50 @@  | 
| 709 | 709 | 
		 | 
| 710 | 710 | 
		public:  | 
| 711 | 711 | 
		 | 
| 712 | 712 | 
		class Snapshot;  | 
| 713 | 713 | 
		 | 
| 714 | 714 | 
		protected:  | 
| 715 | 715 | 
		 | 
| 716 | 716 | 
		void saveSnapshot(Snapshot &s)  | 
| 717 | 717 | 
		    {
	 | 
| 718 | 718 | 
		s._graph = this;  | 
| 719 | 719 | 
		s.node_num = nodes.size();  | 
| 720 | 720 | 
		s.arc_num = arcs.size();  | 
| 721 | 721 | 
		}  | 
| 722 | 722 | 
		 | 
| 723 | 723 | 
		void restoreSnapshot(const Snapshot &s)  | 
| 724 | 724 | 
		    {
	 | 
| 725 | 725 | 
		      while(s.arc_num<arcs.size()) {
	 | 
| 726 | 726 | 
		int n=arcs.size()-1;  | 
| 727 | 727 | 
		Edge arc=edgeFromId(n/2);  | 
| 728 | 728 | 
		Parent::notifier(Edge()).erase(arc);  | 
| 729 | 729 | 
		std::vector<Arc> dir;  | 
| 730 | 730 | 
		dir.push_back(arcFromId(n));  | 
| 731 | 731 | 
		dir.push_back(arcFromId(n-1));  | 
| 732 | 732 | 
		Parent::notifier(Arc()).erase(dir);  | 
| 733 | 
		nodes[arcs[n].target].first_out=arcs[n].next_out;  | 
|
| 734 | 
		nodes[arcs[n-1].target].first_out=arcs[n-1].next_out;  | 
|
| 733 | 
		nodes[arcs[n-1].target].first_out=arcs[n].next_out;  | 
|
| 734 | 
		nodes[arcs[n].target].first_out=arcs[n-1].next_out;  | 
|
| 735 | 735 | 
		arcs.pop_back();  | 
| 736 | 736 | 
		arcs.pop_back();  | 
| 737 | 737 | 
		}  | 
| 738 | 738 | 
		      while(s.node_num<nodes.size()) {
	 | 
| 739 | 739 | 
		int n=nodes.size()-1;  | 
| 740 | 740 | 
		Node node = nodeFromId(n);  | 
| 741 | 741 | 
		Parent::notifier(Node()).erase(node);  | 
| 742 | 742 | 
		nodes.pop_back();  | 
| 743 | 743 | 
		}  | 
| 744 | 744 | 
		}  | 
| 745 | 745 | 
		 | 
| 746 | 746 | 
		public:  | 
| 747 | 747 | 
		 | 
| 748 | 748 | 
		///Class to make a snapshot of the digraph and to restrore to it later.  | 
| 749 | 749 | 
		 | 
| 750 | 750 | 
		///Class to make a snapshot of the digraph and to restrore to it later.  | 
| 751 | 751 | 
		///  | 
| 752 | 752 | 
		///The newly added nodes and arcs can be removed using the  | 
| 753 | 753 | 
		///restore() function.  | 
| 754 | 754 | 
		///  | 
| 755 | 755 | 
		///\note After you restore a state, you cannot restore  | 
| 756 | 756 | 
		///a later state, in other word you cannot add again the arcs deleted  | 
| 757 | 757 | 
		///by restore() using another one Snapshot instance.  | 
| 758 | 758 | 
		///  | 
0 comments (0 inline)