36 lines
656 B
C++
36 lines
656 B
C++
#ifndef VERTEX_H_
|
|
#define VERTEX_H_
|
|
|
|
#include <cstdint>
|
|
#include <compare>
|
|
#include <ostream>
|
|
#include <vector>
|
|
|
|
namespace graph {
|
|
|
|
template<typename T>
|
|
class Vertex {
|
|
public:
|
|
Vertex() = default;
|
|
Vertex(T v) : v(v) {}
|
|
|
|
T v;
|
|
std::uint16_t index = -1;
|
|
std::uint16_t lowlink = -1;
|
|
bool onStack = false;
|
|
std::vector<Vertex<T>> edges;
|
|
|
|
auto operator<=>(const Vertex&) const = default;
|
|
|
|
template<typename T>
|
|
friend inline std::ostream& operator<<(std::ostream& os, const Vertex<T>& v);
|
|
};
|
|
|
|
template<typename T>
|
|
inline std::ostream& operator<<(std::ostream& os, const Vertex<T>& vout) {
|
|
return os << vout.v;
|
|
}
|
|
|
|
} // namespace graph
|
|
|
|
#endif |