GraphStream Users

Archives de la liste Aide


Re: How to make a png or a jpg with a Graph?


Chronologique Discussions 
  • From: guilhelm savin <guilhelm.savin AT gmail.com>
  • To: graphstream-users AT litislab.fr
  • Subject: Re: How to make a png or a jpg with a Graph?
  • Date: Tue, 7 Jun 2011 22:43:55 +0200
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=JmnfKlgcZMFmYp1bvAHcQe1rsTpKGGPy97gixtH8MfPfn8ziPd0g7UlKdjgWRanQ0g XCVUuhZLE/ZcBiryP7a8a/XjkUnksM+p6ip72dZcy8DlXyeeyG+wEG9jeY+xq3JtdU++ /133bxpa6IzmvHJiPkZXFXN3QJCT8CedWxSZ8=

Thanks.

To enable a really high quality rendering, use the
'setQuality(Quality.HIGH)' method of FileSinkImages.

Can you give more informations about Correlation
Algorithm and what you expect of it ? I can not find
informations about correlation applied to graph.

2011/6/7 Rodrigo Lins <lins.oliveira AT gmail.com>
Hi Guilhelm!

Thanks a lot for your help!
I got it! I just add a step on my graph and voilà!
I change the output resolution to XGA to improve the quality. For this version of my application I'll use only a image generated by GraphStream, but in the next one I'll try to put in a Applet.

I have another question, are you working on a implementation of a Correlation Algorithm, the Pearson's Product-Moment?
I'm using a implementation of this algorithm from Apache Math. If I had some time i'll try to make an implementation of this algorithm, but now i'll use the apache implementation.

Congratulations for your excelent job!
Rodrigo.


On Tue, Jun 7, 2011 at 2:13 PM, guilhelm savin <guilhelm.savin AT gmail.com> wrote:
Hi Rodrigo,

I think I can help you :)

The way you want to use FileSinkImages (using writeAll()) is not
implemented ! But it is interesting and missing way to produce
images and I think I will add it soon.

FileSinkImages is done to output images according to some events,
for example in your code images are outputed when a step begins
(OutputPolicy.ByStepOutput). But there is no step in your graph
so no image are produced.

The first solution I can tell you is to introduce a step at the
end of your build :

Graph graph = new SingleGraph("Tutorial 1");
FileSinkImages fsi = new FileSinkImages("simples", OutputType.JPG,
Resolutions.VGA, OutputPolicy.ByStep);
fsi.setLayoutPolicy(LayoutPolicy.ComputedAtNewImage);
graph.addSink(fsi);

graph.addNode("A");
graph.getNode("A").setAttribute("ui.label", "A");
graph.addNode("B");
graph.getNode("B").setAttribute("ui.label", "B");
graph.addNode("C");
graph.getNode("C").setAttribute("ui.label", "C");
graph.addEdge("AB", "A", "B");
graph.addEdge("BC", "B", "C");
graph.addEdge("CA", "C", "A");

graph.stepBegins(1);

For the second solution, you have to checkout the sources of gs-core
from github with the last commit I have just done which change the
visibility of the 'outputNewImage()' method of FileSinkImages.

Note that in new version of FileSinkImages, enum constant names have
been changed to follow the convention, so for example,
OutputPolicy.ByStepOutput becomes OutputPolicy.BY_STEP.

There is still lot of work to do on this sink, and I really thank you
to report your problem because this helps to improve the features. I
will add the writeAll() feature on FileSinkImages.

Hope this help. If not, please ask for more help :)
Regards.


2011/6/7 Rodrigo Lins <lins.oliveira AT gmail.com>
Thank you Guilhelm for your help.
But i'm facing a lot of problems to finish my application.
I'm making some test to find a better Graph API and I realy like GraphStream but I can't print a simple image.

I have this test class:
package sandboxie.graphstream;

import java.io.IOException;

import org.graphstream.graph.Graph;
import org.graphstream.graph.implementations.SingleGraph;
import org.graphstream.stream.file.FileSinkImages;
import org.graphstream.stream.file.FileSinkImages.LayoutPolicy;
import org.graphstream.stream.file.FileSinkImages.OutputPolicy;
import org.graphstream.stream.file.FileSinkImages.OutputType;
import org.graphstream.stream.file.FileSinkImages.Resolutions;


public class GsCoreTeste
{
    public static void main(String[] args)
    {
        Graph graph = new SingleGraph("Tutorial 1");
        FileSinkImages fsi = new FileSinkImages("simples", OutputType.JPG, Resolutions.VGA, OutputPolicy.ByStepOutput);
        fsi.setLayoutPolicy(LayoutPolicy.ComputedAtNewImage);
        graph.addSink(fsi);
       
        graph.addNode("A");
        graph.getNode("A").setAttribute("ui.label", "A");
        graph.addNode("B");
        graph.getNode("B").setAttribute("ui.label", "B");
        graph.addNode("C" );
        graph.getNode("C").setAttribute("ui.label", "C");
        graph.addEdge("AB", "A", "B");
        graph.addEdge("BC", "B", "C");
        graph.addEdge("CA", "C", "A");
       
        graph.display();
       
       
        try
        {
            fsi.writeAll(graph, "123");
        } catch (IOException e)
        {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

}

and I want to export a image form the graph to exibit on a web page or i need to be able to do a Applet to show the graph drawing.
I don't find in the documentation how to do it.
I realy appreciate if you or someone help me.

Thanks for all!

Rodrigo Lins.


On Mon, May 30, 2011 at 5:16 PM, guilhelm savin <guilhelm.savin AT gmail.com> wrote:

Dear Rodrigo Lins,

Thanks for the interest you have to graphstream.
You can find a tutorial about images here : http://graphstream-project.org/doc/Tutorials/Creating-a-movie-with-FileSinkImages_1.0/

If something is missing according to what you want to do, please tell me what, I will be really happy to help you.

Best regards.
Guilhelm

Le 30 mai 2011 19:41, "Rodrigo Lins" <lins.oliveira AT gmail.com> a écrit :

> I'm using the Graph Stream and it is awsome!
> But i need to generate an image with my graph and i don't know how to do it
> and I don't find any example to do this.
>
> Thanks for your help.
>
> Rodrigo Lins




--
Guilhelm Savin
PhD Student of Computer Science





--
Guilhelm Savin
PhD Student of Computer Science




Archives gérées par MHonArc 2.6.16.

Top of page