Roomba Controller Dashboard 1
A GUI and TCP client application that is used to control a Roomba for Computer Engineering 2880 @ Iowa State
Loading...
Searching...
No Matches
Graph.hpp
Go to the documentation of this file.
1//
2// Created by caleb on 11/9/21.
3//
4
5#ifndef ANOTHERGRAPH_GRAPH_H
6#define ANOTHERGRAPH_GRAPH_H
7
8#include "Node.hpp"
9#include "Pose2D.hpp"
10#include <stack>
11
12#include "vector"
13#include "map"
14
15
16template <typename V>
17class Graph {
18 protected:
19 typedef std::pair<double, std::vector<Node<V>*>> pair;
21 bool operator()(const pair& first, const pair& second) {
22 return first.first > second.first;
23 }
24 };
25 std::vector<Node<V>*> nodes;
26 std::vector<std::vector<double>> matrix;
27 Node<V>* head = nullptr;
28 std::map<Node<V>*, unsigned int> nodeMap;
29
30
34 void resize();
35
41 int numVisited(std::vector<bool> listOfBools);
42
49 bool contains(Node<V>* node, std::vector<Node<V>*> listOfNodes);
50
51 //void printAdjacent(Node<V>* next);
52
53 public:
58 void addNode(Node<V>* newNode);
59
60 // void printOut();
61
68 void addNode(Node<V>* nextNode, std::vector<Node<V>*> adjacentNodes, double weight);
69
75 void addNode(Node<V> *nextNode, std::vector<Node<V>*> adjacentNodes);
76
83
90 void addConnection(Node<V> *one, Node<V> *two, double weight);
91
98
106
111 void setHead(int index);
112
117 void removeNode(size_t index);
118
125 std::vector<Node<V>*> Dijkstra(Node<V>* from, Node<V>* find);
126
131 std::vector<std::vector<double>> getAdjacencyList();
132
138 std::vector<Node<V>*> getAdj(Node<V>* next);
139
143 std::vector<Node<V>*> getNodes();
144
145 // void playGround();
146
147 Graph();
148
149 // std::vector<Node<V>*> FrugalKugel(Node<V>* find, unsigned int steps);
150
151 ~Graph();
152
153};
154
155template class Graph<Pose2D>;
156
157
158#endif //ANOTHERGRAPH_GRAPH_H
std::pair< double, std::vector< Node< V > * > > pair
Definition Graph.hpp:19
~Graph()
Definition Graph.cpp:254
std::vector< std::vector< double > > matrix
Definition Graph.hpp:26
Graph()
Definition Graph.cpp:14
void removeNode(size_t index)
Definition Graph.cpp:390
Node< V > * head
Definition Graph.hpp:27
void addConnection(Node< V > *one, Node< V > *two, double weight)
Definition Graph.cpp:267
std::vector< std::vector< double > > getAdjacencyList()
Definition Graph.cpp:262
std::vector< Node< V > * > getAdj(Node< V > *next)
Definition Graph.cpp:172
void setHead(int index)
Definition Graph.cpp:185
void addNode(Node< V > *newNode)
Definition Graph.cpp:102
std::vector< Node< V > * > nodes
Definition Graph.hpp:25
void resize()
Definition Graph.cpp:79
std::vector< Node< V > * > Dijkstra(Node< V > *from, Node< V > *find)
Definition Graph.cpp:191
int numVisited(std::vector< bool > listOfBools)
Definition Graph.cpp:289
std::map< Node< V > *, unsigned int > nodeMap
Definition Graph.hpp:28
std::vector< Node< V > * > getNodes()
Definition Graph.cpp:97
bool contains(Node< V > *node, std::vector< Node< V > * > listOfNodes)
Definition Graph.cpp:87
bool operator()(const pair &first, const pair &second)
Definition Graph.hpp:21