GCNGraph.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 /// \file GCNGraph.h
3 /// \brief GCNGraph for GCN
4 /// \author Leigh H. Whitehead - leigh.howard.whitehead@cern.ch
5 ////////////////////////////////////////////////////////////////////////
6 
7 #ifndef CVN_GCNGRAPH_H
8 #define CVN_GCNGRAPH_H
9 
10 #include <ostream>
11 #include <vector>
13 
14 namespace cvn
15 {
16 
17  /// GCNGraph, basic input for the GCN
18  class GCNGraph
19  {
20  public:
21 
22  /// Default constructor
23  GCNGraph();
24  /// Constructor with position and feature vectors
25  GCNGraph(std::vector<std::vector<float>> positions, std::vector<std::vector<float>> features);
26  /// Construct graph from a vector of GCNGraphNodes
27  GCNGraph(std::vector<GCNGraphNode> nodes);
28  /// Destructor
29  ~GCNGraph(){};
30 
31  /// Add a new node
32  void AddNode(std::vector<float> position, std::vector<float> features);
33  void AddNode(std::vector<float> position, std::vector<float> features,
34  std::vector<float> groundTruth);
35  void AddNode(GCNGraphNode node);
36 
37  /// Get the number of nodes
38  const unsigned int GetNumberOfNodes() const;
39 
40  /// Access nodes
41  const GCNGraphNode& GetNode(const unsigned int index) const;
42  GCNGraphNode& GetNodeEditable(const unsigned int index);
43 
44  /// Return minimum and maximum position coordinate values
45  const std::vector<std::pair<float,float>> GetMinMaxPositions() const;
46  const std::pair<float,float> GetCoordinateMinMax(unsigned int index) const;
47 
48  /// Get the extent in each dimension
49  const std::vector<float> GetSpacialExtent() const;
50  const float GetCoordinateSpacialExtent(unsigned int index) const;
51 
52  /// Function to linearise the graph to a vector for zlib file creation
53  const std::vector<float> ConvertGraphToVector() const;
54 
55  /// Return the number of coordinates for each node
56  const unsigned int GetNumberOfNodeCoordinates() const;
57 
58  /// Return the number of features for each node
59  const unsigned int GetNumberOfNodeFeatures() const;
60 
61  private:
62 
63  /// Store the nodes
64  std::vector<GCNGraphNode> fNodes;
65 
66  };
67 
68  std::ostream& operator<<(std::ostream& os, const GCNGraph& m);
69 
70 }
71 
72 #endif // CVN_GCNGRAPH_H
const unsigned int GetNumberOfNodeCoordinates() const
Return the number of coordinates for each node.
Definition: GCNGraph.cxx:161
Node for GCN.
GCNGraph, basic input for the GCN.
Definition: GCNGraph.h:18
std::ostream & operator<<(std::ostream &os, const PixelMapProducer &p)
struct vector vector
void AddNode(std::vector< float > position, std::vector< float > features)
Add a new node.
Definition: GCNGraph.cxx:37
const std::vector< float > GetSpacialExtent() const
Get the extent in each dimension.
Definition: GCNGraph.cxx:114
Utility class for truth labels.
const char features[]
Definition: feature_tests.c:2
GCNGraph()
Default constructor.
Definition: GCNGraph.cxx:16
const std::vector< std::pair< float, float > > GetMinMaxPositions() const
Return minimum and maximum position coordinate values.
Definition: GCNGraph.cxx:78
#define nodes
GCNGraphNode & GetNodeEditable(const unsigned int index)
Definition: GCNGraph.cxx:68
const float GetCoordinateSpacialExtent(unsigned int index) const
Definition: GCNGraph.cxx:126
const std::pair< float, float > GetCoordinateMinMax(unsigned int index) const
Definition: GCNGraph.cxx:105
const GCNGraphNode & GetNode(const unsigned int index) const
Access nodes.
Definition: GCNGraph.cxx:59
~GCNGraph()
Destructor.
Definition: GCNGraph.h:29
std::vector< GCNGraphNode > fNodes
Store the nodes.
Definition: GCNGraph.h:64
const unsigned int GetNumberOfNodeFeatures() const
Return the number of features for each node.
Definition: GCNGraph.cxx:170
const std::vector< float > ConvertGraphToVector() const
Function to linearise the graph to a vector for zlib file creation.
Definition: GCNGraph.cxx:138
const unsigned int GetNumberOfNodes() const
Get the number of nodes.
Definition: GCNGraph.cxx:54