Here you can find the source of saveGraph(List> graph, String sFileName)
public static void saveGraph(List<List<Integer>> graph, String sFileName) throws IOException
//package com.java2s; /**// w w w . java 2s . c om * BioJava development code * * This code may be freely distributed and modified under the * terms of the GNU Lesser General Public Licence. This should * be distributed with the code. If you do not have a copy, * see: * * http://www.gnu.org/copyleft/lesser.html * * Copyright for this code is held jointly by the individual * authors. These should be listed in @author doc comments. * * For more information on the BioJava project and its aims, * or to join the biojava-l mailing list, visit the home page * at: * * http://www.biojava.org/ * * Created on Oct 5, 2011 * Created by Andreas Prlic * * @since 3.0.2 */ import java.io.FileWriter; import java.io.IOException; import java.util.List; public class Main { /** * Saves a graph into a csv file in the format of tuples (vertex,edge) for every edge in the graph. * The graph has to be in the form of an adjacency list. */ public static void saveGraph(List<List<Integer>> graph, String sFileName) throws IOException { FileWriter writer = new FileWriter(sFileName); writer.append("Vertex,Edge\n"); for (Integer i = 0; i < graph.size(); i++) { for (int j = 0; j < graph.get(i).size(); j++) { writer.append(i.toString()); writer.append(','); writer.append(graph.get(i).get(j).toString()); writer.append('\n'); } } writer.flush(); writer.close(); } }