ObjectInputStream ois = new ObjectInputStream(new FileInputStream("graphs.txt"));
Graph obj = (Graph) ois.readObject();
boolean eof = false;
while (!eof){
try{
System.out.println(obj.adjMatrixToString());
obj = (Graph) ois.readObject();
} catch(EOFExeption e){
eof = true;
}
}