src/main/java/de/dfki/lt/loot/digraph/io/GraphPrinterFactory.java
public static <EI> void print(Graph<EI> g, Path fileName,
      GraphElementPrinter<EI> printer)
    throws IOException {

    PrintWriter out =
      new PrintWriter(Files.newBufferedWriter(
          fileName, Charset.defaultCharset()));
    printer.startGraph(out, g);

    for (int node = 0; node < g.getNumberOfVertices(); ++node) {
      if (g.isVertex(node)) {
        printer.printNode(out, node);
      }
    }

    for (int node = 0; node < g.getNumberOfVertices(); ++node) {
      if (g.isVertex(node) && g.getOutEdges(node) != null) {
        for (Edge<EI> edge : g.getOutEdges(node)) {
          printer.printEdge(out, edge);
        }
      }
    }
    printer.endGraph(out);
    out.close();
  }
/**
   * This writes this graph in graphviz format to the given file so that it can
   * be processed with the graphviz package (http://www.graphviz.org/)
   *
   * @param fileName a <code>String</code> with the file name
   * @param printer a class with which special printing can be handled
   * @throws <code>IOException</code> if an error ccurs when writing the file
   */
This writes this graph in graphviz format to the given file so that it can
be processed with the graphviz package

@param fileName a String with the file name
@param printer a class with which special printing can be handled
@throws IOException if an error ccurs when writing the file
This writes this graph in graphviz format to the given file so that it can be processed with the graphviz package @param fileName a String with the file name @param printer a class with which special printing can be handled @throws IOException if an error ccurs when writing the file
public static <EI> void print(Graph<EI> g, Path fileName,
      GraphElementPrinter<EI> printer)
    throws IOException {
    PrintWriter out =
      new PrintWriter(Files.newBufferedWriter(
          fileName, Charset.defaultCharset()));
    printer.startGraph(out, g);
    for (int node = 0; node < g.getNumberOfVertices(); ++node) {
      if (g.isVertex(node)) {
        printer.printNode(out, node);
      }
    }
    for (int node = 0; node < g.getNumberOfVertices(); ++node) {
      if (g.isVertex(node) && g.getOutEdges(node) != null) {
        for (Edge<EI> edge : g.getOutEdges(node)) {
          printer.printEdge(out, edge);
        }
      }
    }
    printer.endGraph(out);
    out.close();
  }
public static < EI > void print ( Graph < EI > g , Path fileName , GraphElementPrinter < EI > printer ) throws IOException { PrintWriter out = new PrintWriter ( Files . newBufferedWriter ( fileName , Charset . defaultCharset ( ) ) ) ; printer . startGraph ( out , g ) ; for ( int node = 0 ; node < g . getNumberOfVertices ( ) ; ++ node ) { if ( g . isVertex ( node ) ) { printer . printNode ( out , node ) ; } } for ( int node = 0 ; node < g . getNumberOfVertices ( ) ; ++ node ) { if ( g . isVertex ( node ) && g . getOutEdges ( node ) != null ) { for ( Edge < EI > edge : g . getOutEdges ( node ) ) { printer . printEdge ( out , edge ) ; } } } printer . endGraph ( out ) ; out . close ( ) ; }
This writes this graph in graphviz format to the given file so that it can
 be processed with the graphviz package (http://www.graphviz.org/)
This writes this graph in graphviz format to the given file so that it can be processed with the graphviz package ( http : // www . graphviz . org / )