GraphStream Users

Archives de la liste Aide


Re: FileSinkImages and Graph


Chronologique Discussions 
  • From: Kammoun Abderrahmen <kammoun3bderrahmen AT gmail.com>
  • To: graphstream-users AT litislab.fr, guilhelm savin <guilhelm.savin AT gmail.com>
  • Cc: laoheike AT gmail.com
  • Subject: Re: FileSinkImages and Graph
  • Date: Wed, 9 May 2012 14:47:03 +0200

hi, can i apply the algorithm of Girvan et Newman for communities detection with graph-stream ?
Best regards. 

2012/5/9 guilhelm savin <guilhelm.savin AT gmail.com>
Hi and welcome on the mailing list,

OutputPolicy is documented in the tutorial :

It allows to define when images are produced. For example, setting
output policy to BY_STEP will produce image at each step of the graph.

There are two issues that can lead to your problem :

1. If no image are produced, problem is linked to the output policy. Default
   policy is None, so no images are produced. Set it to BY_STEP and insert a
   step when you want to have an image produced :

| Graph g = ... ;
| FileSinkImages img = new FileSinkImages();
| g.addSink(img);
| img.setOutputPolicy(OutputPolicy.BY_STEP);
| g.addNode("A");
| g.addNode("B");
| g.addNode("C");
| 
| g.stepBegins(0); // Produces an image

2. But the previous code will produce blank images and this is
   the second issue : nodes do not have any coordinates, so you
   have to enable a layout :

| 
| img.setLayoutPolicy(LayoutPolicy.COMPUTED_FULLY_AT_NEW_IMAGE);
| 

If this does not solve your problem, please post the code you
are using and I will try to help you more.

Regards

Guilhelm

2012/5/9 <laoheike AT gmail.com>

Hi,

I would like to create a movie out of a graph. However, I'm a little bit lost.

I'm using version 1.1 and I followed the tutorial
http://graphstream-project.org/doc/Tutorials/Creating-a-movie-with-FileSinkImages_1.0/
with minor fixes for version 1.1.

I start with an empty graph, then instanciate a FileSinkImage and assign it as
a sink to the graph. After that I add nodes and edges to the graph and it is
supposed to output the images. However, I've nothing in the folder... The code
compiles, but I don't know why it's not doing what I want. I tried to look into
the API, but things are not well documented (for instance, what
"FileSinkImages.OutputPolicy.BY_STEP" is for?) So I played around and it seems
the only things working is with .BY_EVENT...

Could you please explain more what are these output policies about?

Thanks for your help,

Hei Ke

Here is my code:

               DefaultGraph g = new DefaultGraph("Awesome graph");

               // FileSinkImages arguments
               OutputPolicy outputPolicy = OutputPolicy.BY_STEP;
               String prefix = "images/prefix_";
               OutputType type = OutputType.PNG;
               Resolution resolution = Resolutions.HD720;

               FileSinkImages fsi = new FileSinkImages(type, resolution);

               // Optional configuration
               fsi.setStyleSheet("graph { padding: 50px; fill-color: black; }"
+ "node { fill-color: #3d5689; }" + "edge { fill-color: white; }");
               fsi.setOutputPolicy(outputPolicy);
               fsi.setLayoutPolicy(LayoutPolicy.COMPUTED_AT_NEW_IMAGE);
               fsi.setQuality(FileSinkImages.Quality.HIGH);

               // Images production
               g.addSink(fsi);
               try {
                       fsi.begin(prefix);
                       g.addNode("A");
                       g.addNode("B");
                       g.addNode("C");
                       g.addEdge("AB", "A", "B");
                       g.addEdge("AC", "A", "C");
                       g.addEdge("BC", "B", "C");
                       g.display();
                       fsi.end();
               } catch (IOException e) {
                       // TODO Auto-generated catch block
                       e.printStackTrace();
               }



--
Guilhelm Savin
PhD Student of Computer Science





Archives gérées par MHonArc 2.6.16.

Top of page