-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGraph.h
More file actions
35 lines (28 loc) · 851 Bytes
/
Copy pathGraph.h
File metadata and controls
35 lines (28 loc) · 851 Bytes
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
#ifndef GRAPH_H
#define GRAPH_H
#include <string>
#include <vector>
#include <unordered_map>
struct Building {
int id;
std::string name;
};
class Graph {
private:
std::vector<Building> buildings;
std::unordered_map<std::string, int> nameToId;
std::vector<std::vector<std::pair<int,int>>> adj;
public:
Graph();
int addBuilding(const std::string& name);
void addPath(const std::string& from, const std::string& to, int distance);
void removePath(const std::string& from, const std::string& to);
void listBuildings() const;
void listPaths() const;
int getId(const std::string& name) const;
void bfs(const std::string& startName) const;
void dfs(const std::string& startName) const;
void shortestPath(const std::string& from,
const std::string& to) const;
};
#endif