changeset 155:58ef417d1f76

graph: todot now has a string version.
author Sigurd Meldgaard <stm@daimi.au.dk>
date Fri, 04 Dec 2009 10:49:58 +0100
parents 27fae551afef
children c5d3949639f5
files pysmcl/graph.py
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/pysmcl/graph.py	Fri Dec 04 10:42:39 2009 +0100
+++ b/pysmcl/graph.py	Fri Dec 04 10:49:58 2009 +0100
@@ -1,5 +1,4 @@
-
-# Import library packages.
+import StringIO
 import sys
 
 class Node:
@@ -40,3 +39,8 @@
 
             stack += current.out # list concatenation
         print >>output, "}"
+
+    def to_dot_string(self):
+        output = StringIO.StringIO()
+        self.to_dot(output)
+        return output.getvalue()