I am using GraphStream in a project and my problem is that I want to retrieve the list of connected components but I only get either their count or at the very best their Ids.
I have tried this code but it doesn't return anything :
ConnectedComponents cc = new ConnectedComponents();
cc.init(graph);
System.out.println("List of Connected Components :");
for(ConnectedComponent conn : cc) {
System.out.println("Component " + conn.id + " :");
System.out.println("--------------");
for(Node n : conn.getEachNode()) {
Object[] attr = n.getAttribute("xy");
Double x = (Double) attr[0];
Double y = (Double) attr[1];
System.out.println(x + " , " + y);
}
}
The nodes have an attribute "xy" which contains the coordinates stored as Double[].
What did I do wrong? And how can I fix it?
ConnectedComponents
has been rewritten in commit on 2015-12-15. There was a problem with retrieving content of components.
If you are not using the git version of GraphStream, maybe you should give it a try.