[Gd-chatter] r11633 - trunk/libraries/graphviz-renderer

turbo24prg at gwydiondylan.org turbo24prg at gwydiondylan.org
Fri Jan 18 01:36:31 CET 2008


Author: turbo24prg
Date: Fri Jan 18 01:36:31 2008
New Revision: 11633

Modified:
   trunk/libraries/graphviz-renderer/dot-generator.dylan
   trunk/libraries/graphviz-renderer/graph-classes.dylan
Log:
Job: minor
 * fixed pre-/successor order
 * implemented attributes for graphs


Modified: trunk/libraries/graphviz-renderer/dot-generator.dylan
==============================================================================
--- trunk/libraries/graphviz-renderer/dot-generator.dylan	(original)
+++ trunk/libraries/graphviz-renderer/dot-generator.dylan	Fri Jan 18 01:36:31 2008
@@ -6,6 +6,11 @@
  (graph :: <graph>, output :: <stream>, #key top-node) => ()
   let top-node = top-node | graph.nodes[0];
   write(output, "digraph G {\n");
+  if (graph.attributes.size > 0)
+    for (value keyed-by name in graph.attributes)
+      write(output, concatenate("  ", name, " = \"", value ,"\";\n"));
+    end for;
+  end if;
   process-nodes(top-node, output);
   write(output, "}\n");
 end;
@@ -14,6 +19,7 @@
     (top-node :: <node>, output :: <stream>) => ()
   let nodes-queue = make(<deque>);
   push(nodes-queue, top-node);
+  do(curry(push-last, nodes-queue), predecessors(top-node));
   let visited = make(<stretchy-vector>);
   while (nodes-queue.size > 0)
     let node = nodes-queue.pop;

Modified: trunk/libraries/graphviz-renderer/graph-classes.dylan
==============================================================================
--- trunk/libraries/graphviz-renderer/graph-classes.dylan	(original)
+++ trunk/libraries/graphviz-renderer/graph-classes.dylan	Fri Jan 18 01:36:31 2008
@@ -6,6 +6,7 @@
 define sealed class <graph> (<object>)
   constant slot nodes :: <stretchy-vector> = make(<stretchy-vector>);
   constant slot edges :: <stretchy-vector> = make(<stretchy-vector>);
+  constant slot attributes :: <string-table> = make(<string-table>);
 end;
 
 define sealed class <node> (<object>)
@@ -65,12 +66,12 @@
   end;
 end;
 
-define function add-predecessors (node :: <node>, pres :: <collection>) => ()
+define function add-successors (node :: <node>, pres :: <collection>) => ()
   let nodes-to-connect = maybe-create-nodes(node.graph, pres);
   map(curry(create-edge, node.graph, node), nodes-to-connect);
 end;
 
-define function add-successors (node :: <node>, succs :: <collection>) => ()
+define function add-predecessors (node :: <node>, succs :: <collection>) => ()
   let nodes-to-connect = maybe-create-nodes(node.graph, succs);
   map(rcurry(curry(create-edge, node.graph), node), nodes-to-connect);
 end;



More information about the chatter mailing list