GraphStream Users

Archives de la liste Aide

Re: Edge weight

Chronologique Discussions 
  • From: Stefan Balev <stefan.balev AT>
  • To: Matheus Silva <matheus.g.unicamp AT>
  • Cc: "graphstream-users AT" <graphstream-users AT>
  • Subject: Re: Edge weight
  • Date: Tue, 21 Jun 2016 10:35:49 +0200


GraphStream uses force-based layout algorithm and there are many factors that determine the length of the edges. The "layout.weight" attribute is just a hint, don't expect that when the layout stabilize the lengths will correspond exactly to the values you set. By the way, this is not always possible: take as example a triangle ABC with weights AB = 3, BC = AC = 1.

Try to play with a triangle to get a feeling on the influence of this attribute. For bigger graphs this attribute tends to have less influence. Even if you leave the default values, the edges are not all of equal length.



2016-06-21 1:58 GMT+02:00 Matheus Silva <matheus.g.unicamp AT>:

And just to clarify what i misswrote. To edges im applying layout.weight.




De: Matheus Silva
Enviado:segunda-feira, 20 de junho de 2016 18:24
Para: Stefan Balev
Cc:graphstream-users AT
Assunto: RES: Edge weight


Thank you, it helped a little.


Here’s my problem. When i do:

ps: A and B are nodes.

                A.addAttribute("layout.force", 0);

                B.addAttribute("layout.force", 0);


It Works, they are grouped together.


But when i do not apply this to nodes, but apply this to a specific edge, it does nothing, the lenght of the edge keep beeing 1. It can be happening because of the layout beeing set to   viewer.enableAutoLayout()?





De: Stefan Balev
Enviado:segunda-feira, 20 de junho de 2016 18:04
Para: Matheus Silva
Cc:graphstream-users AT
Assunto: Re: Edge weight


OK, I see. There is an attribute called "layout.weight". Its default value is 1. Setting it smaller/larger than 1 tends to make edges shorter/longer.



2016-06-20 22:39 GMT+02:00 Matheus Silva <matheus.g.unicamp AT>:

Well, setting the force on an edge to 0, i expect nodes from each side to get closer and if i increase the weight, them to get far from each other.



De: Stefan Balev
Enviado:segunda-feira, 20 de junho de 2016 17:37
Para: graphstream-users AT; Matheus Silva
Assunto: Re: Edge weight




What did you expect ? (no, this is not a Schweppes commercial, just trying to figure out what you want to do).








2016-06-20 22:21 GMT+02:00 Matheus Silva <matheus.g.unicamp AT>:

Greetings everyone.

Is there anyway to change the weight on each edge? Ive tried using the setAttribute("weight", myWeight) but it didnt work as expected.


Thank you.







Archives gérées par MHonArc 2.6.16.

Top of page