CSCI3081W Drone Delivery System
Graph.h
1 #ifndef GRAPH_H_
2 #define GRAPH_H_
3 
4 #include <optional>
5 #include <vector>
6 
7 #include "RoutingStrategy.h"
8 #include "vector3.h"
9 
10 namespace routing {
11 
12 class GraphNode {
13  private:
14  int id;
15  Vector3 position;
16 
17  public:
18  GraphNode(int, const Vector3&);
19  int getID() const { return id; }
20  Vector3 getPosition() const { return position; }
21 };
22 
23 class Graph {
24  public:
25  std::vector<std::vector<int>> adjacencyList;
26  std::vector<GraphNode> nodes;
27  Graph() {}
28  void addNode(const Vector3&);
29  void addEdge(int, int);
30  int nearestNode(const Vector3&) const;
31  std::optional<std::vector<Vector3>> getPath(const Vector3&, const Vector3&,
32  const RoutingStrategy&) const;
33 };
34 } // namespace routing
35 
36 #endif // GRAPH_H_
a simple class used for vector math, most function are self explanatory
Definition: vector3.h:12
Definition: Graph.h:12
Definition: Graph.h:23
Definition: RoutingStrategy.h:9