27 if(positions.size() !=
features.size()){
28 std::cerr <<
"The number of nodes must be the same for the position and feature vectors" <<
std::endl;
31 for(
unsigned int n = 0;
n < positions.size(); ++
n){
44 std::vector<float> groundTruth){
61 std::cerr <<
"GCNGraph::GetNode(): Can't access node with index " << index <<
std::endl;
70 std::cerr <<
"GCNGraph::GetNode(): Can't access node with index " << index <<
std::endl;
80 std::pair<float,float> dummyPair = std::make_pair(1.e6,-1.e6);
81 std::vector<std::pair<float,float>> minMaxVals;
84 std::cerr <<
"No nodes found in the graph, returning empty vector" <<
std::endl;
90 minMaxVals.push_back(dummyPair);
94 std::vector<float> nodePos = node.GetPosition();
95 for(
unsigned int p = 0;
p < nodePos.size(); ++
p){
96 if(nodePos[
p] < minMaxVals[
p].first) minMaxVals[
p].first = nodePos[
p];
97 if(nodePos[
p] > minMaxVals[
p].
second) minMaxVals[
p].second = nodePos[
p];
106 if(coord >
fNodes.size()){
107 std::cerr <<
"Node index is out of bounds" <<
std::endl;
118 std::vector<float> extent;
119 for(std::pair<float,float> pair : minMaxVals){
120 extent.push_back(pair.second - pair.first);
127 if(coord >
fNodes.size()){
128 std::cerr <<
"Node index is out of bounds" <<
std::endl;
140 std::vector<float> nodeVector;
144 for(
const float pos : node.GetPosition()){
145 nodeVector.push_back(
pos);
148 for(
const float feat : node.GetFeatures()){
149 nodeVector.push_back(feat);
152 for (
const float truth : node.GetGroundTruth()) {
153 nodeVector.push_back(truth);
163 std::cerr <<
"Graph has no nodes, returning 0" <<
std::endl;
166 else return fNodes[0].GetNumberOfCoordinates();
172 std::cerr <<
"Graph has no nodes, returning 0" <<
std::endl;
175 else return fNodes[0].GetNumberOfFeatures();
const unsigned int GetNumberOfNodeCoordinates() const
Return the number of coordinates for each node.
auto coord(Vector &v, unsigned int n) noexcept
Returns an object to manage the coordinate n of a vector.
GCNGraph, basic input for the GCN.
std::ostream & operator<<(std::ostream &os, const PixelMapProducer &p)
void AddNode(std::vector< float > position, std::vector< float > features)
Add a new node.
const std::vector< float > GetSpacialExtent() const
Get the extent in each dimension.
Utility class for truth labels.
GCNGraph()
Default constructor.
const std::vector< std::pair< float, float > > GetMinMaxPositions() const
Return minimum and maximum position coordinate values.
GCNGraphNode & GetNodeEditable(const unsigned int index)
const float GetCoordinateSpacialExtent(unsigned int index) const
const std::pair< float, float > GetCoordinateMinMax(unsigned int index) const
const GCNGraphNode & GetNode(const unsigned int index) const
Access nodes.
std::vector< GCNGraphNode > fNodes
Store the nodes.
const unsigned int GetNumberOfNodeFeatures() const
Return the number of features for each node.
const std::vector< float > ConvertGraphToVector() const
Function to linearise the graph to a vector for zlib file creation.
const unsigned int GetNumberOfNodes() const
Get the number of nodes.
second_as<> second
Type of time stored in seconds, in double precision.
QTextStream & endl(QTextStream &s)