Add solution for "Day 18: RAM Run", part 2
This commit is contained in:
@@ -28,7 +28,23 @@ class WeightedEdgeGraph
|
||||
void addEdge(const int vertex1, const int vertex2, const int weight);
|
||||
int getVertexWeight(const int vertex) const;
|
||||
int getEdgeWeight(const int edge) const;
|
||||
std::vector<int> dijkstra(const int source) const;
|
||||
|
||||
struct PathsResult
|
||||
{
|
||||
PathsResult()
|
||||
: distances{}, predecessors{}
|
||||
{
|
||||
}
|
||||
PathsResult(const size_t size, const int initialDistance, const int initialPredecessor)
|
||||
: distances(size, initialDistance), predecessors(size, initialPredecessor)
|
||||
{
|
||||
}
|
||||
std::vector<int> distances;
|
||||
std::vector<int> predecessors;
|
||||
};
|
||||
|
||||
PathsResult dijkstra(const int source) const;
|
||||
static constexpr int getInfiniteDistance();
|
||||
|
||||
struct Incidence
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user