edge.cpp
Go to the documentation of this file.
1 #include "lib/spanning_tree.h"
2 
3 edge::edge (int f, int t, int c) : from(f), to(t), cost(c)
4 {
5 }
6 
7 bool edge::operator== (const edge &e) const
8 {
9  return from == e.from && to == e.to && cost == e.cost;
10 }
11 
12 bool compare_edge::operator() (const edge& a, const edge& b) const
13 {
14  return a.cost < b.cost;
15 }
16 
17 size_t hash_edge::operator() (const edge& e) const
18 {
19  return hash<string>()(to_string(e.cost) + to_string(e.from) + to_string(e.to));
20 }
bool operator==(const edge &e) const
Compare this edge to another one.
Definition: edge.cpp:7
int cost
The cost of the edge, i.e., length.
Definition: edge.h:40
int to
The ending vertex of the edge.
Definition: edge.h:35
A class for representing edges.
Definition: edge.h:9
bool operator()(const edge &a, const edge &b) const
Compare two edge objects in terms of cost.
Definition: edge.cpp:12
size_t operator()(const edge &e) const
Generate the hash of an edge.
Definition: edge.cpp:17
int from
The starting vertex of the edge.
Definition: edge.h:30
edge(int f, int t, int c)
Constructor that initializes the private member variables.
Definition: edge.cpp:3


coverage_path
Author(s): Micha Sende
autogenerated on Thu Oct 31 2019 10:37:30