19 package ca.uqac.lif.synthia.tree;
21 import java.io.PrintStream;
22 import java.util.ArrayDeque;
23 import java.util.HashSet;
24 import java.util.Queue;
44 m_nodeString =
"[style=\"filled\",shape=\"circle\",label=\"\"]";
57 ps.println(
"digraph G {");
61 ps.println(
"graph G {");
64 Set<Node<T>> visited =
new HashSet<Node<T>>();
65 Queue<Node<T>> to_visit =
new ArrayDeque<Node<T>>();
67 while (!to_visit.isEmpty())
69 Node<T> current = to_visit.remove();
70 if (visited.contains(current))
75 int id =
getId(current);
76 ps.println(
id +
" [color=\"" +
getColor(current) +
"\",label=\"" +
getLabel(current) +
"\"];");
79 int t_id =
getId(child);
82 ps.println(
id +
" -> " + t_id +
";");
86 if (!visited.contains(child))
88 ps.println(
id +
" -- " + t_id +
";");
91 if (!visited.contains(child) && !to_visit.contains(child))
110 @SuppressWarnings(
"unchecked")
111 public static
void toDot(PrintStream ps,
Node<? extends Object> start)