GraphStream Users

Archives de la liste Aide

dynamically computing ui attributes based on other attributes

Chronologique Discussions 
  • From: "Mularz, Diane E." <mularz AT>
  • To: "graphstream-users AT" <graphstream-users AT>
  • Subject: dynamically computing ui attributes based on other attributes
  • Date: Wed, 2 Apr 2014 15:02:27 +0000
  • Accept-language: en-US

I am reviewing the material on graphStream’s ui and have a question about dynamically setting ui attributes.


For instance, I want to set the size of a node based on its edge count.  That value isn’t known until the graph is constructed.  In the viewer-basics documentation I see an example where an edge’s color is set based on the value stored in its maximum speed attribute.  But the stylesheet has been setup apriori to a range of color values.  When using the edge count for a node, this range wouldn’t be know apriori.  


In the case where I want to assign a color attribute to an edge based on the value of another edge attribute at creation time I can see that I can create a style class for each edge attribute and then add the ui attribute after I create the referenced attribute:  


In stylesheet:

edge.x {size:2px; stroke-color:red, stroke-width:1px;stroke-mode:plain);


In code:

edge.addAttribute(“x”, valueOfX);

edge.addAttribute("ui.class", "x");


But what if I want to set the width of the edge based on its attribute “weight” and that value isn’t known until the edge is created?


Also, where can I find a complete description of stylesheet options?




Diane Mularz

Systems Software Engineer

Performance Speciality

The MITRE Corporation

Modeling & Simulation Technical Center

7515 Colshire Dr.

McLean, VA 22102

mularz AT





No element should function merely as a vehicle to extricate oneself from the mire of indecision


Ring the bells that still can ring

Forget your perfect offering

There is a crack in everything

That’s how the light gets in

-          Leonard Cohen


Archives gérées par MHonArc 2.6.16.

Top of page