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

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


Author: enrico
Date: Tue Sep 27 15:28:00 2005
New Revision: 1385

Modified:
   tagcoll/trunk/   (props changed)
   tagcoll/trunk/tagcoll/experiments.cc
   tagcoll/trunk/tagcoll/experiments.h
Log:
 r5431 at viaza:  enrico | 2005-09-27 07:53:39 -0500
 Tried more refining on the dot output


Modified: tagcoll/trunk/tagcoll/experiments.cc
==============================================================================
--- tagcoll/trunk/tagcoll/experiments.cc	(original)
+++ tagcoll/trunk/tagcoll/experiments.cc	Tue Sep 27 15:28:00 2005
@@ -227,12 +227,53 @@
 	return i->second;
 }
 
+template<typename TAG>
+static string formatNode(const OpSet<TAG>& node)
+{
+//#if 0
+	string res;
+	for (typename OpSet<TAG>::const_iterator i = node.begin();
+			i != node.end(); i++)
+		if (i == node.begin())
+			res += *i;
+		else
+			res += "\\n" + *i;
+	return res;
+//#endif
+	//return "node";
+}
+
 template<typename ITEM, typename TAG>
-void Graph<ITEM,TAG>::buildGraph(const OpSet<TAG>& node)
+void Graph<ITEM,TAG>::buildGraph(const OpSet<TAG>& node, int maxdist)
 {
-	cout << "node" << getHandle(node) << ";" << endl;
+	int dist;
 
-	
+	cout << "node" << getHandle(node) << "[" <<
+		"label=\"" << formatNode(node) << "\"," <<
+		"fontsize=4" <<
+		"];" << endl;
+
+	for (typename tagsets_t::const_iterator i = this->tagsets.begin();
+			i != this->tagsets.end(); i++)
+		if ((dist = i->first.distance(node)) > 0 && dist <= maxdist)
+		{
+			int handle = getHandle(i->first);
+			cout << "node" << handle << "[" <<
+				"label=\"" << formatNode(i->first) << "\"," <<
+				"fontsize=" << maxdist + 2 - dist <<
+				"];" << endl;
+			cout << "node" << getHandle(node) << "--node" << handle << "[" <<
+				"label=\"" << dist << "\"," <<
+				"weight=\"" << dist << "\"" <<
+				"];" << endl;
+		}
+#if 0
+		if (i->second.distance(node) == 1)
+		{
+			cout << "node" << getHandle(i->second) << ";" << endl;
+			cout << getHandle(node) << "--" << getHandle(i->second) << ";" << endl;
+		}
+#endif
 }
 
 

Modified: tagcoll/trunk/tagcoll/experiments.h
==============================================================================
--- tagcoll/trunk/tagcoll/experiments.h	(original)
+++ tagcoll/trunk/tagcoll/experiments.h	Tue Sep 27 15:28:00 2005
@@ -119,7 +119,7 @@
 public:
 	Graph() : seq(0) {}
 
-	void buildGraph(const OpSet<TAG>& node);
+	void buildGraph(const OpSet<TAG>& node, int maxdist = 3);
 };
 
 }



More information about the Debtags-commits mailing list