org.graphstream.ui.layout.springbox
Class Energies

java.lang.Object
  extended by org.graphstream.ui.layout.springbox.Energies

public class Energies
extends Object

Represent the history of energy values for a force-based layout algorithm.

The main intended usage is with the various force layout algorithms that use a an "energy" minimization process to compute a layout. This class allows to store the energy at a current step of layout computation and to remember a history of such steps.

At a current step of layout computation, one can accumulate energy in the current cell of the energies buffer using accumulateEnergy(double). When the step finishes, one calls storeEnergy() to store this accumulated energy in a cell of the memory, push a new cell on the memory and therefore start a new step.

At any time you can get the last energy value computed with getEnergy(). Be careful this is not the energy currently accumulated but the value of the last energy stored with storeEnergy(). You can also get at any time the average energy in the memory with getAverageEnergy(), as well as an estimate of the stabilization (how much the energies are varying) using getStabilization().


Constructor Summary
Energies()
           
 
Method Summary
 void accumulateEnergy(double value)
          Accumulate some energy in the current energy cell.
 double getAverageEnergy()
          The average energy in the whole buffer.
 int getBufferSize()
          The number of energy values remembered, the memory.
 double getEnergy()
          The last computed energy value.
 double getPreviousEnergyValue(int stepsBack)
          A previous energy value.
 double getStabilization()
          A number in [0..1] with 1 meaning fully stabilized.
 void storeEnergy()
          Add a the current accumulated energy value in the set.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Energies

public Energies()
Method Detail

getEnergy

public double getEnergy()
The last computed energy value.

Returns:
The actual level of energy.

getBufferSize

public int getBufferSize()
The number of energy values remembered, the memory.


getStabilization

public double getStabilization()
A number in [0..1] with 1 meaning fully stabilized.

Returns:
A value that indicates the level of stabilization in [0-1].

getAverageEnergy

public double getAverageEnergy()
The average energy in the whole buffer.

Returns:
The average energy.

getPreviousEnergyValue

public double getPreviousEnergyValue(int stepsBack)
A previous energy value.

Parameters:
stepsBack - The number of steps back in history. This number must not be larger than the size of the memory (energy buffer) else it is set to this size.
Returns:
The energy value at stepsBack in time.

accumulateEnergy

public void accumulateEnergy(double value)
Accumulate some energy in the current energy cell.

Parameters:
value - The value to accumulate to the current cell.

storeEnergy

public void storeEnergy()
Add a the current accumulated energy value in the set.



Copyright © 2012. All Rights Reserved.