24 typename FirstHasHigherPriority = std::greater<T>>
38 FirstHasHigherPriority first_has_higher_priority_fn_;
60 const int final_heap_size =
data_.size();
61 if (final_heap_size > 1) {
62 for (
int64_t i = this->get_parent(final_heap_size - 1); i >= 0; i--) {
63 this->heapify(i, final_heap_size);
66 heap_size_ = final_heap_size;
84 return heap_size_ == 0;
113 return heap_to_orig_[0];
122 const int64_t top_index_orig = heap_to_orig_[0];
124 if (heap_size_ > 1) {
125 this->swap_indices(0, heap_size_);
126 this->heapify(0, heap_size_);
128 return top_index_orig;
137 const int64_t heap_index = orig_to_heap_[index];
138 if (heap_index >= heap_size_) {
142 this->heapify(heap_index, heap_size_);
151 int64_t current = orig_to_heap_[index];
152 if (current >= heap_size_) {
160 const int64_t parent = this->get_parent(current);
161 if (this->first_has_higher_priority(parent, current)) {
164 this->swap_indices(current, parent);
203 return heap_to_orig_;
212 return this->partial_to_dot(heap_size_);
218 const T &value_a =
data_[heap_to_orig_[
a]];
219 const T &value_b =
data_[heap_to_orig_[
b]];
220 return first_has_higher_priority_fn_(value_a, value_b);
226 orig_to_heap_[heap_to_orig_[
a]] =
a;
227 orig_to_heap_[heap_to_orig_[
b]] =
b;
233 const int left = this->get_left(parent);
234 const int right = this->get_right(parent);
235 if (left < heap_size && this->first_has_higher_priority(
left, max_index)) {
238 if (right < heap_size && this->first_has_higher_priority(
right, max_index)) {
241 if (max_index != parent) {
242 this->swap_indices(parent, max_index);
243 this->heapify(max_index, heap_size);
245 if (
left < heap_size) {
248 if (
right < heap_size) {
256 return (child - 1) / 2;
261 return parent * 2 + 1;
266 return parent * 2 + 2;
269 std::string partial_to_dot(
const int size)
const
272 Array<dot::Node *> dot_nodes(
size);
273 for (
const int i : IndexRange(
size)) {
274 std::stringstream ss;
275 ss <<
data_[heap_to_orig_[i]];
276 const std::string name = ss.str();
278 node.set_shape(dot::Attr_shape::Rectangle);
279 node.attributes.set(
"ordering",
"out");
280 dot_nodes[i] = &
node;
282 const int64_t parent = this->get_parent(i);
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble right
Span< T > as_span() const
Span< int64_t > active_indices() const
Span< int64_t > inactive_indices() const
Span< int64_t > all_indices() const
std::string to_dot() const
void priority_decreased(const int64_t index)
InplacePriorityQueue(Span< T > data)
void priority_increased(const int64_t index)
int64_t peek_index() const
void priority_changed(const int64_t index)
constexpr Span drop_front(int64_t n) const
constexpr Span take_front(int64_t n) const
DirectedEdge & new_edge(NodePort from, NodePort to)
std::string to_dot_string() const
Node & new_node(StringRef label)
static const pxr::TfToken b("b", pxr::TfToken::Immortal)