Dear GraphStream Team,
Warm Greeting!.
I am using GraphStream Library in one of my java projects , where I have a requirement of storing(serializing) the Graph object generated for later use.
I create graph using SingleGraph(). I have tried GSON as well as readObject and writeObject technique of serialising and deserealiszing the java objects. But didn't got any success :(.
following is the code snippet :
public class SerializablePerson implements Serializable
{
private String lastName;
SingleGraph graph;
SerializablePerson()
{
this.graph = new SingleGraph();
Generator gen = new WattsStrogatzGenerator(10,2,.5);
gen.addSink(graph);
gen.begin();
while(gen.nextEvents()) {}
//graph.display(false);
gen.end();
}
...
....
}
when I try to serialize above field lastName gets serialized properly but graph isn't.
I am stuck. I will appreciate any help from your end.
An alternate solution where i won't be needing to serialize my graph object is , if i can somehow get same graph every time i generate a graph using :
Generator gen = new WattsStrogatzGenerator(10,2,.5);
but unfortunately the above snippet generates random graphs as obvious. Is there any alternative to achieve the same.
Regards,
Ravi Prakash