dijkstra is now bleching fast
deleting from the grid is now bleaching fast added new helper methods many new test-cases many new methods for geo classes and others added a bunch of new grid-walkers
This commit is contained in:
@@ -52,13 +52,23 @@ template <typename T> struct DijkstraEdge {
|
||||
((src == other.dst) && (dst == other.src));
|
||||
}
|
||||
|
||||
// std::set was slower than std::unordered_set
|
||||
// bool operator < (const DijkstraEdge& other) const {
|
||||
// return ((size_t)src * (size_t)dst) < ((size_t)other.src * (size_t)other.dst);
|
||||
// }
|
||||
|
||||
};
|
||||
|
||||
/** allows adding DijkstraEdge<T> to hash-maps */
|
||||
namespace std {
|
||||
template <typename T> struct hash<DijkstraEdge<T>>{
|
||||
size_t operator()(const DijkstraEdge<T>& e) const {
|
||||
return hash<size_t>()( (size_t)e.src^(size_t)e.dst);
|
||||
|
||||
// dunno why but this one provided the fastet results even though
|
||||
// this should lead to the most hash-collissions?!
|
||||
return hash<size_t>()( std::min((size_t)e.src, (size_t)e.dst) );
|
||||
//return hash<size_t>()( (size_t)e.src * (size_t)e.dst );
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user