TSPLIB
|
#include <ValidateGraph.hpp>
Public Member Functions | |
Graph (const std::vector< std::vector< double > > &adjacencyMatrix) | |
Graph (const Graph &graph) | |
Graph & | operator= (const Graph &graph) |
bool | getIsUndirected () const |
std::vector< std::vector < double > >::size_type | getN () const |
double | getEdgeCost (const std::vector< std::vector< double > >::size_type i, const std::vector< double >::size_type j) const |
Protected Member Functions | |
void | setAdjacencyMatrixElement (const std::vector< std::vector< double > >::size_type i, const std::vector< double >::size_type j, const double value) |
double | getAdjacencyMatrixElement (const std::vector< std::vector< double > >::size_type i, const std::vector< double >::size_type j) const |
Private Attributes | |
bool | isUndirected |
std::vector< std::vector < double > >::size_type | n |
std::vector< std::vector < double > > | adjacencyMatrix |
Friends | |
std::ostream & | operator<< (std::ostream &os, Graph &graph) |
Saves one weighted complete graph. This class provides no checks of ranges.
Definition at line 35 of file ValidateGraph.hpp.
Graph::Graph | ( | const std::vector< std::vector< double > > & | adjacencyMatrix | ) |
Constructor for the class Graph.
adjacencyMatrix | Adjacency matrix of a weighted undirected complete graph. The elements in the matrix are the costs. The matrix can be either only a lower triangular matrix for undirected graphs or it can be a square matrix for the directed graph. In both cases on the main diagonale there must be 0. |
Definition at line 17 of file ValidateGraph.cpp.
Graph::Graph | ( | const Graph & | graph | ) |
Copy constructor for the class Graph.
graph | Instance to be copied. |
Definition at line 48 of file ValidateGraph.cpp.
References getAdjacencyMatrixElement(), getIsUndirected(), and getN().
double Graph::getAdjacencyMatrixElement | ( | const std::vector< std::vector< double > >::size_type | i, |
const std::vector< double >::size_type | j | ||
) | const [inline, protected] |
Returns one element in the adjacency matrix. The parameters are not checked.
i | Row. |
j | Column. |
Definition at line 80 of file ValidateGraph.hpp.
References adjacencyMatrix.
Referenced by getEdgeCost(), Graph(), and operator=().
double Graph::getEdgeCost | ( | const std::vector< std::vector< double > >::size_type | i, |
const std::vector< double >::size_type | j | ||
) | const [inline] |
Returns the cost of the edge from i to j. The parameters are not checked.
i | Start vertex. |
j | End vertex. |
Definition at line 144 of file ValidateGraph.hpp.
References getAdjacencyMatrixElement(), and isUndirected.
Referenced by operator<<().
bool Graph::getIsUndirected | ( | ) | const [inline] |
Returns the indicator indicating if the graph is undirected.
Definition at line 126 of file ValidateGraph.hpp.
References isUndirected.
Referenced by Graph(), main(), operator<<(), and operator=().
std::vector<std::vector<double> >::size_type Graph::getN | ( | ) | const [inline] |
Returns the number of vertices in the graph of the instance.
Definition at line 134 of file ValidateGraph.hpp.
References n.
Referenced by Graph(), main(), operator<<(), and operator=().
Implements the operator "=".
graph | Right side of the operator. |
Definition at line 79 of file ValidateGraph.cpp.
References getAdjacencyMatrixElement(), getIsUndirected(), and getN().
void Graph::setAdjacencyMatrixElement | ( | const std::vector< std::vector< double > >::size_type | i, |
const std::vector< double >::size_type | j, | ||
const double | value | ||
) | [inline, protected] |
Sets one element in the adjacency matrix. The parameters are not checked.
i | Row. |
j | Column. |
value | New value of the element on the i-th row and j-th column. |
Definition at line 67 of file ValidateGraph.hpp.
References adjacencyMatrix.
std::ostream& operator<< | ( | std::ostream & | os, |
Graph & | graph | ||
) | [friend] |
Implements the operator "<<".
os | Ostream. |
graph | Graph. |
Definition at line 117 of file ValidateGraph.cpp.
std::vector<std::vector<double> > Graph::adjacencyMatrix [private] |
Adjacency matrix of a weighted undirected complete graph. The elements in the matrix are the costs. The elements in the matrix are the costs. The matrix can be either only a lower triangular matrix for undirected graphs or it can be a square matrix for the directed graph.
Definition at line 58 of file ValidateGraph.hpp.
Referenced by getAdjacencyMatrixElement(), and setAdjacencyMatrixElement().
bool Graph::isUndirected [private] |
Indicator indicating if the graph is undirected.
Definition at line 44 of file ValidateGraph.hpp.
Referenced by getEdgeCost(), and getIsUndirected().
std::vector<std::vector<double> >::size_type Graph::n [private] |
Number of vertices in the graph of the instance.
Definition at line 49 of file ValidateGraph.hpp.
Referenced by getN().