com.Bayesia.positioning.structure
Interface Graph


public interface Graph

The interface Graph is used to describe a the structure of a bi-dimensional graph. It is used directly by the positioning algorithms.

The needed methods are described below. A Graph must provide the dimension of the available area used to locate the vertices. It must provide the number of vertices, their positions and their maximum dimensions i.e. the width and the height of their bounding box (the rectangle in which a vertex is contained).

The Graph must provide also a method used to evaluate the positions given by the algorithm without modifying the initial positions. The positions are modified only with the method setPositions(double[][]).

Version:
2.0 28/10/04

Method Summary
 double evaluatePositions(double[][] positions)
          Evaluate the given positions to the vertices of the graph.
 double getAvailableHeight()
          Return the height of the area the graph must be contained in.
 double getAvailableWidth()
          Return the width of the area the graph must be contained in.
 int[][] getEdgeIndices()
          Return the indices of the two vertices of each edge in the graph.
 int getEdgeNumber()
          This method return the number of edges in the graph.
 double[][] getMaximumDimensions()
          Return an array containing the maximum width and the maximum height of each vertex.
 double[][] getPositions()
          Return the positions of the vertices in the graph.
 int getSize()
          This method return the number of vertices in the graph.
 void setPositions(double[][] positions)
          Set the given positions to the vertices of the graph.
 

Method Detail

getSize

public int getSize()
This method return the number of vertices in the graph.

Returns:
the number of vertices

getEdgeNumber

public int getEdgeNumber()
This method return the number of edges in the graph. This method is used only by the SymmetricPositioning algorithm.

Returns:
the number of edges

getAvailableWidth

public double getAvailableWidth()
Return the width of the area the graph must be contained in.

Returns:
the available width

getAvailableHeight

public double getAvailableHeight()
Return the height of the area the graph must be contained in.

Returns:
the available height

getPositions

public double[][] getPositions()
Return the positions of the vertices in the graph. The returned array contains two arrays : the first contains the x positions of the vertices and the second the y positions.

Returns:
the positions of the vertices.

setPositions

public void setPositions(double[][] positions)
Set the given positions to the vertices of the graph. The given array contains two arrays : the first contains the x positions of the vertices and the second the y positions.

Parameters:
positions - the new positons of the vertices.

evaluatePositions

public double evaluatePositions(double[][] positions)
Evaluate the given positions to the vertices of the graph. The given array contains two arrays : the first contains the x positions of the vertices and the second the y positions. It returns the evaluation of the given positions without modifying the positions of the vertices. This method is used only by the GeneticPositioning algorithm.

Parameters:
positions - the positions to evaluate.
Returns:
the result of the evaluation.

getMaximumDimensions

public double[][] getMaximumDimensions()
Return an array containing the maximum width and the maximum height of each vertex. The returned array contains two arrays : the first contains the maximum width of each vertex and the second the maximum height.

Returns:
the maximum dimensions of the vertices.

getEdgeIndices

public int[][] getEdgeIndices()
Return the indices of the two vertices of each edge in the graph. The returned array contains two arrays : the first contains the indices of the first vertices of the edges and the second the indices of the last vertices. This method is used only by the SymmetricPositioning algorithm.

Returns:
the indices of the of the vertices that are the extremities of the edges.