com.Bayesia.positioning.algorithm
Class SymmetricPositioning

java.lang.Object
  extended bycom.Bayesia.positioning.algorithm.SymmetricPositioning

public final class SymmetricPositioning
extends java.lang.Object

The class SymmetricPositioning is used to compute the positions of the vertices of a com.Bayesia.positioning.structure.Graph.

The SymmetricPositioning can be created specifying the initial length wanted for the edges of the graph, if the multi-level option is enabled (this option is very powerful for very large graphs), the convergence thresold, the repulsion factor and the optimization factor.

The inital edge length indicates what is the length the edges should have after positioning. If this length is too big for the graph to fit in the available width and heigth, the length is recomputed in order to fit the graph in the available area. The final length can be retrieved with the method getPreferredEdgeLength().

The convergence thresold indicates the distance allowed for a node to its best location. If you want very precise position, you can use 0.1 for example. A good compromise between performance and precision is to use 1.

The repulsion factor is used only when the multi-level option is enabled. It indicates the repulsion force between two nodes.

The optimization factor indicates the level of optimization of the graph positions. Higher the optimization factor is, better the positioning is.

To listen to the progress of the positioning , a ProgressListener can be added to it.

The start() method can be used in a thread so the algorithm could be stopped with stop().

Please see Graph Please see ProgressListener

Version:
2.0 28/10/04
Author:
Bayesia S.A.

Constructor Summary
SymmetricPositioning(java.lang.String licenseKey, Graph graph, double initialEdgeLength, boolean multiLevel, double convergenceThresold, int repulsion, int optimization)
          Create a new SymmetricPositioning on the given Graph with the specified parameters.
 
Method Summary
 void addProgressListener(ProgressListener l)
          Adds a listener to the list that's notified each time a change to the progress model occurs.
 double getPreferredEdgeLength()
          Return the preferred length of the edges in order tofit the available area.
 void removeProgressListener(ProgressListener l)
          Removes a listener from the list that's notified each time a change to the progress model occurs.
 void start()
          Start the positioning algorithm.
 void stop()
          Stop the running positioning algorithm if this one was run in a thread.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SymmetricPositioning

public SymmetricPositioning(java.lang.String licenseKey,
                            Graph graph,
                            double initialEdgeLength,
                            boolean multiLevel,
                            double convergenceThresold,
                            int repulsion,
                            int optimization)
Create a new SymmetricPositioning on the given Graph with the specified parameters.

Parameters:
licenseKey - a valid license key
graph - the graph on which the positioning is done
initialEdgeLength - the preferred initial length of the edges
multiLevel - true if the multi-level positioning is enabled, false otherwise
convergenceThresold - the convergence thresold (>0)
repulsion - the repulsion fatcor (>0)
optimization - the optimization factor (>0)
See Also:
Graph
Method Detail

addProgressListener

public void addProgressListener(ProgressListener l)
Adds a listener to the list that's notified each time a change to the progress model occurs.

Parameters:
l - the ProgressListener

removeProgressListener

public void removeProgressListener(ProgressListener l)
Removes a listener from the list that's notified each time a change to the progress model occurs.

Parameters:
l - the ProgressListener

start

public void start()
Start the positioning algorithm. This method can be used in thread.

Example :

 final SymmetricPositioning positioning = new SymmetricPositioning(graph, 100, true, 0.1, 10, 100);
 Thread t = new Thread() {
 		public void run() {
 			positioning.start();
 		}
 };
 t.setPriority(Thread.MIN_PRIORITY);
 t.start();
 
To stop the algorithm before it ends, use the stop method.

See Also:
stop()

stop

public void stop()
Stop the running positioning algorithm if this one was run in a thread.

See Also:
start()

getPreferredEdgeLength

public double getPreferredEdgeLength()
Return the preferred length of the edges in order tofit the available area.

Returns:
the preferred length of the edges