GraphStream Users

Archives de la liste Aide


Re: IdAlreadyInUseException While Using BarabasiAlbertGenerator


Chronologique Discussions 
  • From: Stefan Balev <stefan.balev AT gmail.com>
  • To: graphstream-users AT litislab.fr, "Jacob M. H. Smith" <jacob.m.h.smith AT gmail.com>
  • Subject: Re: IdAlreadyInUseException While Using BarabasiAlbertGenerator
  • Date: Fri, 13 Sep 2013 10:29:46 +0200

Hi Jacob,

I could not reproduce this exception. I used the following code:

public static void main(String[] args) {
Graph graph = new SingleGraph("test");
Generator generator = new BarabasiAlbertGenerator();
generator.addSink(graph);
generator.begin();
for (int i = 0; i < 100; i++) {
   generator.nextEvents();
}
generator.end();
graph.clear();
generator = new BarabasiAlbertGenerator();
generator.addSink(graph);
generator.begin();
for (int i = 0; i < 100; i++) {
   generator.nextEvents();
}
generator.end();
}

which executes without exception. Are you sure that you really call graph.clear()? If this is the case, could you provide more details, such as a minimal code reproducing the exception and the stack trace?

Best,

--
Stefan


2013/9/13 Jacob M. H. Smith <jacob.m.h.smith AT gmail.com>
Hello.

I'm using GraphStream 1.2 and I'm having the following problem.

I use the BarabasiAlbertGenerator to populate my graph like this:

/* ============================================== */
Generator generator = new BarabasiAlbertGenerator();
generator.addSink(graph);
generator.begin();
for (int i = 0; i < 100; i++) {
    generator.nextEvents();
}
generator.end();
/* ============================================== */

Later in my program I call the graph's clear() method and do the same thing again. The second time I get an IdAlreadyInUseException.

What am I doing wrong? Am I using the generator or the graph in a way that wasn't intended?

Best regards,
Jacob





Archives gérées par MHonArc 2.6.16.

Top of page