Extended SWIG python interface (inspired by Kyle Ellrott): inference is possible...
[libdai.git] / include / dai / var.h
index 4815da5..0157148 100644 (file)
@@ -15,6 +15,7 @@
 
 
 #include <iostream>
+#include <sstream>
 #include <dai/exceptions.h>
 
 
@@ -115,6 +116,13 @@ class Var {
         friend std::ostream& operator << ( std::ostream& os, const Var& n ) {
             return( os << "x" << n.label() );
         }
+
+        /// Formats a Var as a string
+        std::string toString() const {
+            std::stringstream ss;
+            ss << *this;
+            return ss.str();
+        }
 };