public void write(AbstractBaseGraph<Word, LexicalRelation> graph) {

        Set<Word> graphNodes = graph.vertexSet();
        Writer out = null;
        try {
            
            // A não indicação do charSet, faz com que grave em UTF-8 (final parece
            // que não grava em UTF-8, mas sim aquilo que o sistema mandar).
            // Ao fazer o LOAD para o mysql indicar "CHARACTER SET utf8" 
            FileOutputStream fos = new FileOutputStream(outputFile);
            out = new BufferedWriter(encoding == null ? new OutputStreamWriter(fos)
                    : new OutputStreamWriter(fos, encoding));//new OutputStreamWriter(new FileOutputStream(fileName));

            // If we want to write a header
            if (this.defaultCsvConfig.HEADER) {
                out.write(this.defaultCsvConfig.LINES_STARTING_BY);
                out.write("words");
                out.write(this.defaultCsvConfig.FIELDS_TERMINATED_BY);
                out.write("polarity");
                out.write(this.defaultCsvConfig.FIELDS_TERMINATED_BY);
                out.write("negativeCounter");
                out.write(this.defaultCsvConfig.FIELDS_TERMINATED_BY);
                out.write("neutralCounter");
                out.write(this.defaultCsvConfig.FIELDS_TERMINATED_BY);
                out.write("positiveCounter");
                out.write(this.defaultCsvConfig.FIELDS_TERMINATED_BY);
                out.write("iteration");
                out.write(this.defaultCsvConfig.LINES_TERMINATED_BY);
            }

            // For each word (graph node)
            for (Word w : graphNodes) {
                out.write(this.defaultCsvConfig.LINES_STARTING_BY);

                if (this.defaultCsvConfig.FIELDS_ENCLOSED_BY != NULL_CHAR) {
                    out.write(this.defaultCsvConfig.FIELDS_ENCLOSED_BY);
                }

                out.write(w.getWord());

                if (this.defaultCsvConfig.FIELDS_ENCLOSED_BY != NULL_CHAR) {
                    out.write(this.defaultCsvConfig.FIELDS_ENCLOSED_BY);
                }

                out.write(this.defaultCsvConfig.FIELDS_TERMINATED_BY);

                out.write(String.valueOf(getPolarity(w)));
                out.write(this.defaultCsvConfig.FIELDS_TERMINATED_BY);
                out.write(String.valueOf(w.getNegativeCounter()));
                out.write(this.defaultCsvConfig.FIELDS_TERMINATED_BY);
                out.write(String.valueOf(w.getNeutralCounter()));
                out.write(this.defaultCsvConfig.FIELDS_TERMINATED_BY);
                out.write(String.valueOf(w.getPositiveCounter()));
                out.write(this.defaultCsvConfig.FIELDS_TERMINATED_BY);
                out.write(String.valueOf(w.getIteration()));

                out.write(this.defaultCsvConfig.LINES_TERMINATED_BY);
            }

        } catch (IOException ex) {
            Logger lgr = Logger.getLogger(CsvOutput.class.getName());
            lgr.log(Level.SEVERE, ex.getMessage(), ex);
        } finally {
            if (out != null) {
                try {
                    out.flush();
                    out.close();
                } catch (IOException ex) {
                }
            }
        }

    }