Package libai.ants
Class Graph
- java.lang.Object
-
- libai.ants.Graph
-
public class Graph extends java.lang.Object
This 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.String
fileSource
If 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.String
getFileSource()
Matrix
getM()
void
save(java.lang.String path)
void
setFileSource(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.Exception
Constructor. 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
-
-