Package libai.ants
Class Graph
- java.lang.Object
-
- libai.ants.Graph
-
public class Graph extends java.lang.ObjectThis class belong to the core classes of the Ant Framework.It represent the problem being solved. It is composed of a Matrix containing the relation between nodes in the graph.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.StringfileSourceIf the graph is loaded from a file, this will be a holder for the file's source location
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetFileSource()MatrixgetM()voidsave(java.lang.String path)voidsetFileSource(java.lang.String fileSource)Sets the file source of the matrix to be loaded
-
-
-
Constructor Detail
-
Graph
public Graph(java.lang.String fileSource) throws java.lang.ExceptionConstructor. Creates a matrix from filefileSource- Parameters:
fileSource- location of file- Throws:
java.lang.Exception- if an error ocurred loading file.
-
Graph
public Graph(int r, int c, double[] d)Constructor. Creates a grpah (matrix) and initialize with the data ondata- Parameters:
r- number of rowsc- number of colsd- values to initialize the matrix.
-
-
Method Detail
-
getM
public Matrix getM()
- Returns:
- The matrix M
-
getFileSource
public java.lang.String getFileSource()
- Returns:
- The file source
-
setFileSource
public void setFileSource(java.lang.String fileSource)
Sets the file source of the matrix to be loaded- Parameters:
fileSource- contains the location of the file
-
save
public void save(java.lang.String path) throws java.io.IOException- Throws:
java.io.IOException
-
-