/** * Write the data in a Graph to a GML OutputStream. * * @param gMLOutputStream the GML OutputStream to write the Graph data to * @throws java.io.IOException thrown if there is an error generating the GML data */ public void outputGraph(final OutputStream gMLOutputStream) throws IOException { // ISO 8859-1 as specified in the GML documentation Writer writer = new BufferedWriter(new OutputStreamWriter(gMLOutputStream, Charset.forName("ISO-8859-1"))); List<Vertex> verticies = new ArrayList<Vertex>(); List<Edge> edges = new ArrayList<Edge>(); populateLists(verticies, edges); if (normalize) { LexicographicalElementComparator comparator = new LexicographicalElementComparator(); Collections.sort(verticies, comparator); Collections.sort(edges, comparator); } writeGraph(writer, verticies, edges); writer.flush(); writer.close(); }