@@ -0,0 +1,1982 @@
+%0Apackage galileo.graph;%0A%0Aimport java.io.OutputStream;%0Aimport java.io.PrintStream;%0A%0A/**%0A * Provides functionality for visualizing graphs using Graphviz.  This class%0A * outputs the graphs in DOT format.%0A *%0A * @author malensek%0A */%0Apublic class DOT %7B%0A%0A    /**%0A     * Traverses the graph provided by a root vertex, writing out the graph%0A     * representation in DOT format.%0A     *%0A     * @param vertex root vertex of the graph to convert%0A     * @param out OutputStream to write the graph to.%0A     */%0A    public static void toDOT(Vertex%3C?, ?%3E vertex, OutputStream out) %7B%0A        DOT.toDOT(vertex, %22Untitled%22, out);%0A    %7D%0A%0A    /**%0A     * Traverses the graph provided by a root vertex, writing out the graph%0A     * representation in DOT format.%0A     *%0A     * @param vertex root vertex of the graph to convert%0A     * @param title title of the graph%0A     * @param out OutputStream to write the graph to.%0A     */%0A    public static void toDOT(Vertex%3C?, ?%3E vertex, String title,%0A            OutputStream out) %7B%0A%0A        PrintStream ps = new PrintStream(out);%0A        writeGraphHeader(title, ps);%0A        writeVertex(vertex, ps);%0A        writeGraphFooter(ps);%0A    %7D%0A%0A    private static void writeVertex(Vertex%3C?, ?%3E v, PrintStream ps) %7B%0A        ps.println(%22%5C%22%22 + v.hashCode() + %22%5C%22%22%0A                + %22 %5Blabel=%5C%22%22 + v.getLabel() + %22%5C%22%5D;%22);%0A%0A        for (Vertex%3C?, ?%3E child : v.getAllNeighbors()) %7B%0A            connect(v.hashCode(), child.hashCode(), ps);%0A        %7D%0A%0A        for (Vertex%3C?, ?%3E child : v.getAllNeighbors()) %7B%0A            writeVertex(child, ps);%0A        %7D%0A    %7D%0A%0A    private static void connect(int from, int to, PrintStream ps) %7B%0A        ps.println(%22%5C%22%22 + from + %22%5C%22 -- %5C%22%22 + to + %22%5C%22%22);%0A    %7D%0A%0A    private static void writeGraphHeader(String title, PrintStream ps) %7B%0A        ps.println(%22graph %22 + title + %22 %7B%22);%0A        ps.println(%22node %5Bfontname=%5C%22Helvetica%5C%22 fontsize=%5C%2220%5C%22%5D%22);%0A    %7D%0A%0A    private static void writeGraphFooter(PrintStream ps) %7B%0A        ps.println(%22%7D%22);%0A    %7D%0A%0A%7D%0A

Add DOT format export capability.