[Debtags-commits] [svn] r1387 - in tagcoll/trunk: . tagcoll

Enrico Zini enrico at costa.debian.org
Tue Sep 27 15:28:42 UTC 2005


Author: enrico
Date: Tue Sep 27 15:28:42 2005
New Revision: 1387

Modified:
   tagcoll/trunk/   (props changed)
   tagcoll/trunk/tagcoll/experiments.cc
   tagcoll/trunk/tagcoll/experiments.h
Log:
 r5433 at viaza:  enrico | 2005-09-27 09:06:44 -0500
 Subgraphs do not steal nodes to other subgrapths


Modified: tagcoll/trunk/tagcoll/experiments.cc
==============================================================================
--- tagcoll/trunk/tagcoll/experiments.cc	(original)
+++ tagcoll/trunk/tagcoll/experiments.cc	Tue Sep 27 15:28:42 2005
@@ -245,14 +245,14 @@
 }
 
 template<typename ITEM, typename TAG>
-void Graph<ITEM,TAG>::buildSubGraph(const OpSet<TAG>& node, set< OpSet<TAG> >& selected, int maxdist)
+void Graph<ITEM,TAG>::buildSubGraph(const OpSet<TAG>& node, OpSet< OpSet<TAG> >& selected, int maxdist)
 {
 	// Lay out the nodes in order of distance
 	for (int i = 1; i <= maxdist && !selected.empty(); i++)
 	{
 		// First connect all nodes that are still left at this distance
 		vector< OpSet<TAG> > connected;
-		for (typename set< OpSet<TAG> >::const_iterator j = selected.begin();
+		for (typename OpSet< OpSet<TAG> >::const_iterator j = selected.begin();
 				j != selected.end(); j++)
 			if ((*j).distance(node) == i)
 			{
@@ -271,9 +271,16 @@
 
 		// Then build the subgraphs for the nodes we just connected, and remove
 		// the nodes added in the subgraphs
+		OpSet< OpSet<TAG> > removed;
 		for (typename vector< OpSet<TAG> >::const_iterator j = connected.begin();
 				j != connected.end(); j++)
-			buildSubGraph(*j, selected, maxdist - i);
+		{
+			OpSet< OpSet<TAG> > subselected(selected);
+			buildSubGraph(*j, subselected, maxdist - i);
+			removed += selected - subselected;
+		}
+
+		selected -= removed;
 	}
 }
 
@@ -289,7 +296,7 @@
 		"];" << endl;
 
 	// Choose and output the nodes that will go in the graph
-	set< OpSet<TAG> > selected;
+	OpSet< OpSet<TAG> > selected;
 	for (typename tagsets_t::const_iterator i = this->tagsets.begin();
 			i != this->tagsets.end(); i++)
 		if ((dist = i->first.distance(node)) > 0 && dist <= maxdist)
@@ -318,13 +325,24 @@
 
 
 #ifndef INSTANTIATING_TEMPLATES
+#ifdef COMPILE_TESTSUITE
+  #define OLD_COMPILE_TESTSUITE 
+  #undef COMPILE_TESTSUITE
+#endif
+
+#include <tagcoll/OpSet.cc>
 #include <string>
 
 namespace Tagcoll {
 	    template class Normalizer<std::string, std::string>;
 	    template class Scores<std::string>;
 	    template class Graph<std::string, std::string>;
+	    template class OpSet< OpSet<std::string> >;
 }
+#ifdef OLD_COMPILE_TESTSUITE
+  #define COMPILE_TESTSUITE 
+  #undef OLD_COMPILE_TESTSUITE
+#endif
 #endif
 
 

Modified: tagcoll/trunk/tagcoll/experiments.h
==============================================================================
--- tagcoll/trunk/tagcoll/experiments.h	(original)
+++ tagcoll/trunk/tagcoll/experiments.h	Tue Sep 27 15:28:42 2005
@@ -27,7 +27,6 @@
 #include <tagcoll/Expression.h>
 
 #include <vector>
-#include <set>
 
 namespace Tagcoll
 {
@@ -116,7 +115,7 @@
 	std::map< OpSet<TAG>, int > handles;
 
 	int getHandle(const OpSet<TAG>& node);
-	void buildSubGraph(const OpSet<TAG>& node, std::set< OpSet<TAG> >& selected, int maxdist);
+	void buildSubGraph(const OpSet<TAG>& node, OpSet< OpSet<TAG> >& selected, int maxdist);
 
 public:
 	Graph() : seq(0) {}



More information about the Debtags-commits mailing list