All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Coordinates.h
Go to the documentation of this file.
1 /*
2  * Coordinates.h
3  *
4  * Created on: 27.01.2014
5  * Author: Henning
6  */
7 
8 #ifndef COORDINATES_H_
9 #define COORDINATES_H_
10 
11 #include "../viz/Point.h"
12 
13 #include <vector>
14 
15 
16 namespace NetworKit {
17 
26 template<class T>
27 class Coordinates {
28 protected:
29  std::vector<Point<T> > data;
30 
31 
32 public:
36  void init(count numNodes) {
37  data.resize(numNodes);
38  }
39 
43  void setCoordinate(index v, const Point<T>& value) {
44  data[v] = value;
45  }
46 
51  return data[v];
52  }
53 
58  T value = data[0][dim];
59  for (index i = 1; i < data.size(); ++i) {
60  T temp = data[i][dim];
61  if (temp < value) {
62  value = temp;
63  }
64  }
65  return value;
66  }
67 
72  T value = data[0][dim];
73  for (index i = 1; i < data.size(); ++i) {
74  T temp = data[i][dim];
75  if (temp > value) {
76  value = temp;
77  }
78  }
79  return value;
80  }
81 
85  void addCoordinates(std::vector<T>& values) {
86  Point<T> p(values);
87  data.push_back(p);
88  }
89 
90  virtual ~Coordinates() {}
91 };
92 
93 
94 } /* namespace NetworKit */
95 #endif /* COORDINATES_H_ */
DEPRECATED: A specialized container for node coordinates is no longer consistent with NetworKit's app...
Definition: Coordinates.h:27
Point< T > & getCoordinate(index v)
Definition: Coordinates.h:50
void init(count numNodes)
Allocates space for numNodes entries.
Definition: Coordinates.h:36
uint64_t index
Typedefs.
Definition: Globals.h:20
virtual ~Coordinates()
Definition: Coordinates.h:90
T minCoordinate(count dim)
Definition: Coordinates.h:57
Formerly marked as deprecated: To take advantage of automatic mapping between C++ and Python data str...
Definition: Point.h:39
uint64_t count
Definition: Globals.h:21
void addCoordinates(std::vector< T > &values)
Insert coordinates of a new vertex.
Definition: Coordinates.h:85
void setCoordinate(index v, const Point< T > &value)
Sets entry at index v to value value.
Definition: Coordinates.h:43
T maxCoordinate(count dim)
Definition: Coordinates.h:71
std::vector< Point< T > > data
Definition: Coordinates.h:29