GCNGraphNode.cxx
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 /// \file GCNGraphNode.cxx
3 /// \brief Node for GCN
4 /// \author Leigh H. Whitehead - leigh.howard.whitehead@cern.ch
5 ///////////////////////////////////////////////////////////////////////
6 
7 #include <cassert>
8 #include <iostream>
9 #include <ostream>
11 
12 namespace cvn
13 {
14 
16  {}
17 
18  GCNGraphNode::GCNGraphNode(std::vector<float> position,std::vector<float> features):
19  fPosition(position),
20  fFeatures(features)
21  {
22 
23  }
24 
25  GCNGraphNode::GCNGraphNode(std::vector<float> position,std::vector<float> features,
26  std::vector<float> groundTruth):
27  fPosition(position),
28  fFeatures(features),
29  fGroundTruth(groundTruth)
30  {
31 
32  }
33 
34  /// Get the node position
35  const std::vector<float> GCNGraphNode::GetPosition() const
36  {
37  return fPosition;
38  }
39 
40  /// Get the node features
41  const std::vector<float> GCNGraphNode::GetFeatures() const
42  {
43  return fFeatures;
44  }
45 
46  /// Get the node truth
47  const std::vector<float> GCNGraphNode::GetGroundTruth() const
48  {
49  return fGroundTruth;
50  }
51 
52  /// Add a node position coordinate
54  fPosition.push_back(pos);
55  }
56 
57  /// Add a node feature
58  void GCNGraphNode::AddFeature(float feature){
59  fFeatures.push_back(feature);
60  }
61 
62  /// Add ground truth information
63  void GCNGraphNode::AddGroundTruth(float truth) {
64  fGroundTruth.push_back(truth);
65  }
66 
67  /// Get the number of features
68  const unsigned int GCNGraphNode::GetNumberOfFeatures() const
69  {
70  return fFeatures.size();
71  }
72 
73  /// Get the number of features
74  const unsigned int GCNGraphNode::GetNumberOfCoordinates() const
75  {
76  return fPosition.size();
77  }
78 
79  /// Get feature
80  const float GCNGraphNode::GetFeature(const unsigned int feature) const
81  {
82  if(feature >= fFeatures.size()){
83  return fFeatures.at(feature);
84  }
85  else{
86  return -999.;
87  }
88  }
89 
90 }
91 
Node for GCN.
std::vector< float > fPosition
Definition: GCNGraphNode.h:54
const std::vector< float > GetGroundTruth() const
Get the node truth.
Utility class for truth labels.
const char features[]
Definition: feature_tests.c:2
const unsigned int GetNumberOfFeatures() const
Get the number of features.
void AddPositionCoordinate(float pos)
Add a node position coordinate.
const std::vector< float > GetFeatures() const
Get the node features.
const unsigned int GetNumberOfCoordinates() const
Get the number of position coordinates.
void AddFeature(float feature)
Add a node feature.
std::vector< float > fGroundTruth
Definition: GCNGraphNode.h:56
GCNGraphNode()
Default constructor.
const std::vector< float > GetPosition() const
Get the node position, features or ground truth.
void AddGroundTruth(float truth)
Set true ID.
const float GetFeature(const unsigned int feature) const
Get feature - zero indexed - and returns -999. if feature doesn&#39;t exist.
std::vector< float > fFeatures
Definition: GCNGraphNode.h:55