GraphStream Users

Archives de la liste Aide

Re: Get Connected Components List

Chronologique Discussions 
  • From: guilhelm savin <guilhelm.savin AT>
  • To: Zakaria Boulouard <zboulouard AT>
  • Cc: "graphstream-users AT" <graphstream-users AT>
  • Subject: Re: Get Connected Components List
  • Date: Wed, 16 Dec 2015 16:39:58 +0100


There is an issue with the actual ConnectedComponents algorithm.
Components count and size are valid, but iteration over nodes of a component will failed.

I made some refactoring for this algorithm. It will be merged soon in the master branch.
If you are confident with git you can already use it.

Else, it will be publish in the nightly builds once the branch will be merged.

Hope it will work better...

2015-12-15 13:19 GMT+01:00 Zakaria Boulouard <zboulouard AT>:
Hi Guilhelm,

I have already tried that and it is still not working.


2015-12-15 12:17 GMT+00:00 guilhelm savin <guilhelm.savin AT>:


Try to add a call to the "compute" method :

cc.compute ();


Le 15 déc. 2015 13:09, <zboulouard AT> a écrit :

I have just started using GraphStream in a project and I find it a very
interesting tool.

My problem is that I want to retreive 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();
            for(ConnectedComponent conn : cc) {
            System.out.println("Partie " + + " :");
            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

What did I do wrong? And how can I fix it?


Doctorant-Ingénieur en Intelligence Économique
N° Téléphone: (+212)662193321

Guilhelm Savin
PhD of Computer Science

Archives gérées par MHonArc 2.6.16.

Top of page