20 #ifndef GALOIS_PRIORITYQUEUE_H
21 #define GALOIS_PRIORITYQUEUE_H
27 #include "galois/config.h"
39 template <
typename T,
typename Cmp = std::less<T>,
40 typename Alloc = galois::FixedSizeAllocator<T>>
42 typedef std::set<T, Cmp, Alloc> Set;
47 typedef typename container_type::reference
reference;
49 typedef typename container_type::pointer
pointer;
50 typedef typename container_type::size_type
size_type;
51 typedef typename container_type::const_iterator
iterator;
63 template <
typename _T,
typename _Cmp = std::less<_T>,
64 typename _Alloc = galois::FixedSizeAllocator<_T>>
70 const Alloc&
alloc = Alloc())
71 : orderedSet(cmp,
alloc) {}
73 template <
typename Iter>
75 const Alloc&
alloc = Alloc())
76 : orderedSet(cmp,
alloc) {
78 orderedSet.insert(*b);
84 bool ret = orderedSet.empty();
107 bool ret = (orderedSet.find(x) != orderedSet.end());
118 auto p = orderedSet.insert(x);
126 orderedSet.erase(orderedSet.begin());
135 if (x == *orderedSet.begin()) {
136 orderedSet.erase(orderedSet.begin());
157 template <
typename T,
typename Cmp = std::less<T>,
158 typename Cont = std::vector<T, runtime::Pow_2_BlockAllocator<T>>>
167 typedef typename container_type::pointer
pointer;
169 typedef typename container_type::const_iterator
iterator;
183 return cmp(right, left);
209 template <
typename Iter>
210 MinHeap(Iter b, Iter e,
const Cmp& cmp = Cmp())
247 typename container_type::iterator nend =
274 template <
typename T,
typename Cmp = std::less<T>>
299 template <
typename Iter>
size_type size() const
Definition: PriorityQueue.h:217
container_type::const_reverse_iterator reverse_iterator
Definition: PriorityQueue.h:171
void reserve(size_type s)
Definition: PriorityQueue.h:268
galois::substrate::SimpleLock Lock_ty
Definition: PriorityQueue.h:291
container_type::reference reference
Definition: PriorityQueue.h:165
container_type::const_reverse_iterator reverse_iterator
Definition: PriorityQueue.h:286
Thread-safe min heap.
Definition: PriorityQueue.h:275
const_iterator begin() const
Definition: PriorityQueue.h:153
container_type::pointer pointer
Definition: PriorityQueue.h:49
bool operator()(const T &left, const T &right) const
Definition: PriorityQueue.h:182
const_iterator end() const
Definition: PriorityQueue.h:266
ThreadSafeMinHeap(const Cmp &cmp=Cmp())
Definition: PriorityQueue.h:297
Cmp cmp
Definition: PriorityQueue.h:178
const_reference top() const
Definition: PriorityQueue.h:219
Cont container_type
Definition: PriorityQueue.h:162
value_type top() const
Definition: PriorityQueue.h:98
bool remove(const value_type &x)
Definition: PriorityQueue.h:239
void reserve(size_type s)
Definition: PriorityQueue.h:373
void push_back(const value_type &x)
Definition: PriorityQueue.h:222
Cont container
Definition: PriorityQueue.h:187
size_type size() const
Definition: PriorityQueue.h:90
container_type::const_iterator iterator
Definition: PriorityQueue.h:284
const_iterator end() const
Definition: PriorityQueue.h:154
container_type::const_iterator iterator
Definition: PriorityQueue.h:51
value_type pop_internal()
Definition: PriorityQueue.h:195
container_type::const_reverse_iterator const_reverse_iterator
Definition: PriorityQueue.h:288
container_type::value_type value_type
Definition: PriorityQueue.h:164
constexpr int GALOIS_CACHE_LINE_SIZE
Definition: CompilerSpecific.h:37
Thread-safe ordered set.
Definition: PriorityQueue.h:41
container_type::const_iterator const_iterator
Definition: PriorityQueue.h:285
Definition: PriorityQueue.h:177
const_reference top_internal() const
Definition: PriorityQueue.h:190
void unlock() const
Definition: SimpleLock.h:68
galois::substrate::SimpleLock Lock_ty
Definition: PriorityQueue.h:56
container_type::const_iterator iterator
Definition: PriorityQueue.h:169
container_type::const_reverse_iterator const_reverse_iterator
Definition: PriorityQueue.h:55
Definition: PriorityQueue.h:159
container_type::const_reverse_iterator const_reverse_iterator
Definition: PriorityQueue.h:173
void push(const value_type &x)
Definition: PriorityQueue.h:333
ThreadSafeOrderedSet(Iter b, Iter e, const Cmp &cmp=Cmp(), const Alloc &alloc=Alloc())
Definition: PriorityQueue.h:74
container_type::const_reference const_reference
Definition: PriorityQueue.h:48
void insert(const value_type &x)
Definition: PriorityQueue.h:331
container_type::reference reference
Definition: PriorityQueue.h:47
void push_back(const value_type &x)
Definition: PriorityQueue.h:330
MinHeap< T, Cmp > container_type
Definition: PriorityQueue.h:277
bool find(const value_type &x) const
Definition: PriorityQueue.h:259
container_type::pointer pointer
Definition: PriorityQueue.h:282
container_type::size_type size_type
Definition: PriorityQueue.h:50
Set container_type
Definition: PriorityQueue.h:45
bool empty() const
Definition: PriorityQueue.h:215
Definition: runtime/Mem.h:864
container_type::value_type value_type
Definition: PriorityQueue.h:279
container_type::size_type size_type
Definition: PriorityQueue.h:283
const_iterator end() const
Definition: PriorityQueue.h:371
container_type::const_iterator const_iterator
Definition: PriorityQueue.h:170
container_type heap
Definition: PriorityQueue.h:294
value_type top() const
Definition: PriorityQueue.h:321
container_type::size_type size_type
Definition: PriorityQueue.h:168
void * alloc()
Definition: PerThreadStorage.cpp:42
value_type pop()
Definition: PriorityQueue.h:123
const_iterator begin() const
Definition: PriorityQueue.h:370
RevCmp(const Cmp &cmp)
Definition: PriorityQueue.h:180
void clear()
Definition: PriorityQueue.h:147
runtime::Pow_2_BlockAllocator< T > alloc_type
Definition: PriorityQueue.h:161
void insert(const value_type &x)
Definition: PriorityQueue.h:223
MinHeap(const Cmp &cmp=Cmp(), const Cont &container=Cont())
Definition: PriorityQueue.h:206
container_type::const_iterator const_iterator
Definition: PriorityQueue.h:52
container_type::const_reference const_reference
Definition: PriorityQueue.h:281
value_type pop()
Definition: PriorityQueue.h:230
bool find(const value_type &x) const
Definition: PriorityQueue.h:105
void lock() const
Definition: SimpleLock.h:55
container_type::pointer pointer
Definition: PriorityQueue.h:167
SimpleLock is a spinlock.
Definition: SimpleLock.h:36
size_type size() const
Definition: PriorityQueue.h:310
container_type::reference reference
Definition: PriorityQueue.h:280
container_type::const_reference const_reference
Definition: PriorityQueue.h:166
void clear()
Definition: PriorityQueue.h:263
container_type::value_type value_type
Definition: PriorityQueue.h:46
ThreadSafeOrderedSet(const Cmp &cmp=Cmp(), const Alloc &alloc=Alloc())
Definition: PriorityQueue.h:69
const_iterator begin() const
Definition: PriorityQueue.h:265
void insert(const value_type &x)
Definition: PriorityQueue.h:114
value_type pop()
Definition: PriorityQueue.h:339
Lock_ty mutex
Definition: PriorityQueue.h:293
ThreadSafeMinHeap(Iter b, Iter e, const Cmp &cmp=Cmp())
Definition: PriorityQueue.h:300
container_type::const_reverse_iterator reverse_iterator
Definition: PriorityQueue.h:53
bool push(const value_type &x)
Definition: PriorityQueue.h:116
bool empty() const
Definition: PriorityQueue.h:82
void clear()
Definition: PriorityQueue.h:363
void push_back(const value_type &x)
Definition: PriorityQueue.h:113
T value_type
Definition: Executor_ParaMeter.h:111
bool empty() const
Definition: PriorityQueue.h:302
void push(const value_type &x)
Definition: PriorityQueue.h:225
RevCmp revCmp
Definition: PriorityQueue.h:188
bool find(const value_type &x) const
Definition: PriorityQueue.h:355