edge.cpp (639B)
1 #include "../include/edge.hpp" 2 3 #include <cstddef> 4 #include <string> 5 6 Edge::Edge(std::size_t v1, std::size_t v2, double length2, 7 std::size_t identifier) 8 : v1Index(v1), v2Index(v2), length2(length2), identifier(identifier) {} 9 10 std::string Edge::toString() const noexcept { 11 return "(v1: " + std::to_string(this->v1Index) + 12 ", v2: " + std::to_string(this->v2Index) + 13 +", traversed: " + std::to_string(this->traversed) + ")"; 14 } 15 16 bool Edge::operator<(const Edge& other) const { 17 return length2 < other.length2; 18 } 19 20 bool Edge::operator>(const Edge& other) const { 21 return length2 > other.length2; 22 }