GraphStream Users

Archives de la liste Aide


Re: ConnectedComponent


Chronologique Discussions 
  • From: Julien SCHLEICH <julien.schleich AT uni.lu>
  • To: guilhelm savin <guilhelm.savin AT gmail.com>
  • Cc: "<graphstream-users AT litislab.fr>" <graphstream-users AT litislab.fr>
  • Subject: Re: ConnectedComponent
  • Date: Wed, 16 May 2012 08:05:33 +0000
  • Accept-language: fr-FR, en-GB, en-US

Hi Guilhelm,

Thanks for your quick answer!

Regards,

Julien
On May 16, 2012, at 1:05 AM, guilhelm savin wrote:

Hi Julien,

You have to define the countAttribute which is disable
by default.

|
| cc.init(g);
| cc.setCountAttribute("cc");
| cc.compute();
|

It should works with that.

Regards.

Guilhelm

2012/5/15 Julien SCHLEICH <julien.schleich AT uni.lu>
Dear all,

I think there is a bug in the gs-algo-1.2-git.jar concerning connected components. 
The ConnectedComponents seems to work well, as their number is good and I can iterate on them.
But somehow, when I want to iterate on the nodes of each connected component, each connected component is empty.
In my code, the size variable is always 0.
Any idea?
Here is the code:

ConnectedComponents cc = new ConnectedComponents(g);
cc.compute();
Iterator<ConnectedComponent> itCC = cc.iterator();
while (itCC.hasNext()){
ConnectedComponent curCC = itCC.next();
Iterator<Node> itNode = curCC.iterator();
while (itNode.hasNext()){
itNode.next();
size++;
}
System.out.println(size);
}

Thanks in advance for your help.

Julien Schleich



--
Guilhelm Savin
PhD Student of Computer Science





Archives gérées par MHonArc 2.6.16.

Top of page