Files
cpp-masssprings/include/graph_distances.hpp
Christoph Urlacher 3230d806f7 restructure puzzle space generation (for boards up to 5x5)
- uses a huge global seen-states-cache. Not scalable without more
filtering
2026-03-07 23:33:55 +01:00

26 lines
780 B
C++

#ifndef DISTANCE_HPP_
#define DISTANCE_HPP_
#include "cpu_spring_system.hpp"
#include <vector>
class graph_distances
{
public:
std::vector<int> distances; // distances[n] = distance from node n to target
std::vector<size_t> parents; // parents[n] = next node on the path from node n to target
std::vector<size_t> nearest_targets; // nearest_target[n] = closest target node to node n
public:
auto clear() -> void;
[[nodiscard]] auto empty() const -> bool;
auto calculate_distances(size_t node_count,
const std::vector<spring>& edges,
const std::vector<size_t>& targets) -> void;
[[nodiscard]] auto get_shortest_path(size_t source) const -> std::vector<size_t>;
};
#endif