package ls.graph.serialize;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.Reader;
import ls.graph.script.ScriptableGraph;
import edu.uci.ics.jung.graph.Graph;
import edu.uci.ics.jung.io.PajekNetReader;
public class DefaultGraphReader implements GraphReader
{
/**
* This implementation of the graph reader returns a scriptable graph instance
*/
public ScriptableGraph readGraphFromFile(File f) throws IOException
{
return this.read(new FileReader(f));
}
public ScriptableGraph read(Reader r) throws IOException
{
PajekNetReader reader = new PajekNetReader();
Graph g = reader.load(r);
return new ScriptableGraph(g);
}
}