A max-priority queue. More...
Typedefs | |
| typedef struct priority_queue | priority_queue_t | 
| Opaque data type for a priority queue.  | |
Functions | |
| int | priority_queue_new (priority_queue_t **pq, size_t size) | 
| Creates a new priority queue.   | |
| int | priority_queue_free (priority_queue_t *pq) | 
| Frees a priority queue.   | |
| int | priority_queue_add (priority_queue_t *pq, void *data, int key, size_t *pos) | 
| Adds an element to the priority queue.   | |
| int | priority_queue_remove_max (priority_queue_t *pq, void **data) | 
| Remove the element with the maximum priority from the priority queue.   | |
| int | priority_queue_change_key (priority_queue_t *pq, size_t pos, int key) | 
| Change the priority key of an element.   | |
| int | priority_queue_get_size (priority_queue_t *pq, size_t *size) | 
| Gets the size of the priority queue.   | |
A max-priority queue.
| int priority_queue_add | ( | priority_queue_t * | pq, | |
| void * | data, | |||
| int | key, | |||
| size_t * | pos | |||
| ) | 
Adds an element to the priority queue.
| pq | the priority queue to add the element to | |
| data | the element to be added | |
| key | the priority key of the element to be added | |
| pos | where to store the current position of the element in the heap | 
Definition at line 242 of file priority_queue.c.
References element::data, and upheap().
Referenced by overlap_graph_remove_cycles().


| int priority_queue_change_key | ( | priority_queue_t * | pq, | |
| size_t | pos, | |||
| int | key | |||
| ) | 
Change the priority key of an element.
| pq | the priority queue the element is in | |
| pos | the position of the element in the priority queue | |
| key | the new key | 
Definition at line 309 of file priority_queue.c.
References downheap(), element::key, and upheap().

| int priority_queue_free | ( | priority_queue_t * | pq | ) | 
Frees a priority queue.
This operation does not free the data added to it by priority_queue_add().
| pq | the priority queue to free | 
Definition at line 202 of file priority_queue.c.
Referenced by overlap_graph_remove_cycles().

| int priority_queue_get_size | ( | priority_queue_t * | pq, | |
| size_t * | size | |||
| ) | 
Gets the size of the priority queue.
| pq | the priority queue | |
| [out] | size | the number of elements contained in the priority queue | 
Definition at line 222 of file priority_queue.c.
Referenced by overlap_graph_remove_cycles().

| int priority_queue_new | ( | priority_queue_t ** | pq, | |
| size_t | capacity | |||
| ) | 
Creates a new priority queue.
| [out] | pq | the created priority queue | 
| capacity | the initial capacity of the priority queue | 
Definition at line 158 of file priority_queue.c.
Referenced by overlap_graph_remove_cycles().

| int priority_queue_remove_max | ( | priority_queue_t * | pq, | |
| void ** | data | |||
| ) | 
Remove the element with the maximum priority from the priority queue.
| pq | the priority queue to remove the element from | |
| [out] | data | the element with the maximum priority | 
Definition at line 279 of file priority_queue.c.
References element::data, and downheap().
Referenced by overlap_graph_remove_cycles().


 1.6.1