GraphStream Users

Archives de la liste Aide

Re: dynamic size of nodes and FileSinkImages

Chronologique Discussions 
  • From: Lao Heike <laoheike AT>
  • To: guilhelm savin <guilhelm.savin AT>
  • Cc: graphstream-users AT
  • Subject: Re: dynamic size of nodes and FileSinkImages
  • Date: Wed, 9 May 2012 23:12:08 +0200


Thanks again for your fast answer. It works now!

I've two more questions:

1. How do you get the default attributes and their respective values? I would like to know what is the default size of a node, when you don't specify anything in the stylesheet.

2. It seems that the "repulsion" between nodes in the "placement" algo (the algo which is in charge of placing the nodes in the graph, and moving them around...) doesn't work very well. I mean, when a node becomes bigger (the ui.size is big) then it might "cover" other nodes. I don't want that since one very big node might cover the entire graph. Actually, I don't understand how to tweak this "placement" algo...

Thanks for your help!

On Wed, May 9, 2012 at 6:29 PM, guilhelm savin <guilhelm.savin AT> wrote:

You have to use 'size-mode: dyn-size' in your CSS :

fsi.setStyleSheet("graph { padding: 50px; fill-color: black; }" + "node { fill-color: #3d5689; size-mode: dyn-size;}" + "edge { fill-color: white; }");

Then, set the size of each node using the 'ui.size' attribute :

| for (Node n : g)
|   n.addAttribute("ui.size", random.nextDouble() * 25 + 5);

It should works ...

2012/5/9 Lao Heike <laoheike AT>
Hi (again),

I'm trying to model the dynamic of a graph in order to generate a video. So far, I managed to make a nice video thanks to graphstream (and your previous answer), but I would like to add more features.

One important feature I would like to see is the size of the node growing/shrinking depending on a given attribute of the node.

I played around with the stylesheet of the FileSinkImages. Unfortunately, I cannot access the "size" attribute of a node. It seems by default that the attributes list is empty...

When I set the size in the stylesheet of my FileSinkImages, for instance like this:
fsi.setStyleSheet("graph { padding: 50px; fill-color: black; }" + "node { fill-color: #3d5689; size: 0.1gu;}" + "edge { fill-color: white; }");

Then for a node SingleNode n = g.getNode("A"); I have:

n.getAttributeCount() is 0 and n.getAttributeKeySet() returns [].

However, it seems that all nodes in the generated images are of size 0.1gu...

How can I increase/decrease the size of the node based on some attribute in a dynamic way?

I'm aware of this tutorial:

However, I want to do that based on a given attribute and for generating images.

Thanks for your help!

Guilhelm Savin
PhD Student of Computer Science

Archives gérées par MHonArc 2.6.16.

Top of page