### Question:
Dot { public static Graph<String> read(String string) { if(string.trim().toLowerCase().startsWith("digraph")) return readDT(string); if(string.trim().toLowerCase().startsWith("graph")) return readUT(string); else throw new IllegalArgumentException("String representation should start with 'digraph' or 'graph'"); }  static Graph<String> read(String string); static UTGraph<String, String> readUT(String string); static DTGraph<String, String> readDT(String string); static void write(Graph<L> graph, File file);  }### Answer:
@Test public void testRead() { Global.randomSeed(); UTGraph<String, String> graph = RandomGraphs.preferentialAttachment(30, 2); UTGraph<String, String> out = Dot.readUT(graph.toString()); System.out.println(graph); System.out.println(out); assertEquals(graph.size(), out.size()); assertEquals(graph.numLinks(), out.numLinks()); }