-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgraph.h
More file actions
38 lines (29 loc) · 971 Bytes
/
graph.h
File metadata and controls
38 lines (29 loc) · 971 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
36
37
38
#ifndef GIT_FIRST_LAB_GRAPH_H
#define GIT_FIRST_LAB_GRAPH_H
#include "abstract_graph.h"
#include <algorithm>
#include <cassert>
#include <functional>
#include <iostream>
#include <queue>
class Graph : public AbstractGraph {
public:
Graph();
explicit Graph(const std::vector<std::vector<Edge>>& from);
explicit Graph(int size);
[[nodiscard]] int GetEdgeLength(int from, int to) const override;
[[nodiscard]] std::vector<Edge> GetEdges(int from) const override;
[[nodiscard]] std::vector<Edge> GetAnyPath(int from, int to) const override;
[[nodiscard]] std::vector<Edge> GetShortestPath(int from, int to) const override;
[[nodiscard]] std::vector<std::vector<Edge>> GetShortestPaths(int from) const override;
private:
struct Path {
long long length;
int to;
Path();
Path(long long len, int new_to);
bool operator>(const Path& rhs) const;
};
std::vector<std::vector<Edge>> connections_;
};
#endif //GIT_FIRST_LAB_GRAPH_H