use of org.graphstream.algorithm.randomWalk.RandomWalk in project gs-ui-javafx by graphstream.
the class TestRandomWalk method run.
private void run() {
MultiGraph graph = new MultiGraph("random walk");
DorogovtsevMendesGenerator gen = new DorogovtsevMendesGenerator();
RandomWalk rwalk = new RandomWalk();
gen.addSink(graph);
gen.begin();
for (int i = 0; i < 400; i++) {
gen.nextEvents();
}
gen.end();
graph.setAttribute("ui.stylesheet", styleSheet);
graph.setAttribute("ui.quality");
graph.setAttribute("ui.antialias");
graph.display();
rwalk.setEntityCount(graph.getNodeCount() * 2);
rwalk.setEvaporation(0.97);
rwalk.setEntityMemory(40);
rwalk.init(graph);
for (int i = 0; i < 3000; i++) {
rwalk.compute();
if (i % 100 == 0) {
System.err.println("step " + i);
updateGraph(graph, rwalk);
}
// Thread.sleep(100)
}
rwalk.terminate();
updateGraph(graph, rwalk);
graph.setAttribute("ui.screenshot", "randomWalk.png");
}
Aggregations