-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathprimalgraph.h
More file actions
44 lines (30 loc) · 1.2 KB
/
primalgraph.h
File metadata and controls
44 lines (30 loc) · 1.2 KB
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
#include <queue>
#include <algorithm>
#include "edge.h"
class PrimalGraph {
public:
PrimalGraph();
void Initialize();
void AddVertex(const Vertex& v);
void AddEdge(const std::string& from, const std::string& to, float time);
const Vertex* GetVertex(const std::string& name) const;
const Vertex* GetNearestVertex(Vertex* v) const;
bool FindWayToVertexFromVertex(const std::string& start,
const std::string& finish,
std::vector <const Edge*>& way) const;
bool FindWayThroughVertexes(const std::vector <std::string>& names,
std::vector <const Edge*>& way) const;
bool IsVertexContains(const std::string& name) const;
void Debug() const;
private:
bool IsEdgeContains(const Edge& e) const;
bool FindWayToVertexFromVertexViaBFS(int start,
int finish,
std::vector <int> & way) const;
private:
std::vector <Vertex> vertexes_;
std::vector <Edge> edges_;
std::map <std::string, int> vertexes_by_name_;
mutable std::map <const Vertex*, int> vertex_to_index_;
std::vector <std::vector <int>> adjacency_list_;
};