GraphStream Users

Archives de la liste Aide


Re: Get Connected Components List


Chronologique Discussions 
  • From: Zakaria Boulouard <zboulouard AT gmail.com>
  • To: guilhelm savin <guilhelm.savin AT gmail.com>, graphstream-users AT litislab.fr
  • Subject: Re: Get Connected Components List
  • Date: Tue, 15 Dec 2015 12:19:38 +0000

Hi Guilhelm,

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

Thanks!

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

Hi,

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

cc.init(graph);
cc.compute ();

Cheers.
Guilhelm

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

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();
            cc.init(graph);
            for(ConnectedComponent conn : cc) {
            System.out.println("Partie " + 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?

Thanks!



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



Archives gérées par MHonArc 2.6.16.

Top of page