Menu

[r66]: / ls / graph / serialize / DefaultGraphReader.java  Maximize  Restore  History

Download this file

32 lines (24 with data), 723 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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);
}
}
MongoDB Logo MongoDB