CkPttn 1.2.4
Loading...
Searching...
No Matches
hamcycle.hpp
Go to the documentation of this file.
1
9#ifndef CKPTTN_MIDLEVEL_HAMCYCLE_HPP
10#define CKPTTN_MIDLEVEL_HAMCYCLE_HPP
11
12#include <functional>
13#include <vector>
14
15#include "vertex.hpp"
16
18using MidVisitFunc = std::function<void(const std::vector<int>& y, int i)>;
19
28 public:
35 explicit MidHamCycle(const MidVertex& x, long long limit, MidVisitFunc visit_f);
37 long long get_length() const { return length_; }
38
39 private:
40 MidVertex x_;
41 MidVertex y_;
42 long long limit_;
43 MidVisitFunc visit_f_;
44 long long length_;
45
46 bool flip_seq(const std::vector<int>& seq, int& dist_to_start, bool final_path);
47};
48
49#endif
Hamiltonian cycle generation for middle-levels Gray code.
Definition hamcycle.hpp:27
long long get_length() const
Get the length of the Hamiltonian cycle.
Definition hamcycle.hpp:37
MidHamCycle(const MidVertex &x, long long limit, MidVisitFunc visit_f)
Construct a MidHamCycle with given vertex, limit, and visit callback.
Bitstring vertex for middle-levels Gray code algorithm.
Definition vertex.hpp:24
std::function< void(const std::vector< int > &y, int i)> MidVisitFunc
Callback function type for visiting vertices during Hamiltonian cycle traversal.
Definition hamcycle.hpp:18
Bitstring vertex representation for middle-levels Gray code.