I am trying to save a GraphStream/NetStream from NetLogo do *.gexf file. Graph has constant number of edges and vertices. Thing that is changing is parameters of nodes/'turtles'. Currently, after each tick, I send information from NetLogo to localhost on port 2012 using:
gs:add-sender "sender" "localhost" 2012
I can receive GraphStream in java project:
create instance of CumulativeGraphAnalyser
NetStreamReceiver receiver = new NetStreamReceiver(2012);
new CumulativeGraphAnalyser(receiver, null);
and this is the CumulativeGraphAnalyser class
public class CumulativeGraphAnalyser extends SinkAdapter{
private NetStreamSender sender;
private Graph graph;
private String mySourceId;
private long myTimeId;
private int round;
public CumulativeGraphAnalyser(NetStreamReceiver receiver, NetStreamSender sender) {
this.sender = sender;
graph = new SingleGraph("cumulative graph", false, false);
ProxyPipe pipe = receiver.getDefaultStream();
pipe.addElementSink(graph);
pipe.addElementSink(this);
round = 1;
mySourceId = toString();
myTimeId = 0;
}
@Override
public void stepBegins(String sourceId, long timeId, double step) {
for (Node node : graph.getNodeSet()){
node.getAttribute("node-id");
node.getAttribute("infected");
(...)
}
System.out.println(round++);
}
}
There are all information I need in the 'graph' variable, but I don't know how to save the GraphStream to file (*.gxef) and after that import it in Gephi. The other option is to read the GraphStream in Gephi directly from localhost:2012. I found plugin which suppose to handle this task, but I don't know how to use it properly. I've searched and read lots of information about this problem, and I've tried to implement some solutions, but none of them doesn't come off.