-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGraph.h
49 lines (37 loc) · 1.03 KB
/
Graph.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#ifndef GRAPH_H
#define GRAPH_H
#include <map>
#include <string>
#include <vector>
typedef double dist;
// Conversion factors from degrees latitude/longitude to feet
// Only valid at area around Notre Dame
#define LAT_TO_FEET 364393.7354401166
#define LONG_TO_FEET 273092.431579933
/*
name - actual name of building
coords - lat/lon coordinates
adjacent - list of edges from the node
node edges - pair of the other graphs KEY and edge wieght DISTANCE
*/
struct Node{
std::string name;
std::pair<dist,dist> coords;
std::vector< std::pair<std::string , dist > > * adjacent;
};
class Graph{
public:
Graph();
~Graph();
void buildgraph( std::string filename );
void insert();
void insert( std::string, std::string, dist, dist );
void insert_edge(std::string, std::string,dist);
void nodedump(); // Print all node keys
dist astar( Node * start, Node * end, bool print );
dist tvsida_star( Node * start, Node * end, dist distance );
Node * get( std::string );
private:
std::map<std::string, Node*> nodes;
};
#endif