Detailed Description
methods for working with priority queue
Various methods to work with the priority queue
Definition in file gcgpqueue.c.
#include "gcgpqueue.h"
#include "pub_gcgpqueue.h"
#include "gcg.h"
#include "scip/def.h"
#include "scip/scip.h"
#include "blockmemshell/memory.h"
#include <assert.h>
Go to the source code of this file.
Macros | |
#define | PQ_PARENT(q) (((q)+1)/2-1) |
#define | PQ_LEFTCHILD(p) (2*(p)+1) |
#define | PQ_RIGHTCHILD(p) (2*(p)+2) |
Functions | |
static SCIP_RETCODE | pqueueResize (GCG_PQUEUE *pqueue, int minsize) |
static SCIP_RETCODE | pqueueHeapify (GCG_PQUEUE *pqueue, int pos) |
SCIP_RETCODE | GCGpqueueCreate (SCIP *scip, GCG_PQUEUE **pqueue, int initsize, SCIP_DECL_SORTPTRCOMP((*ptrcomp))) |
void | GCGpqueueFree (GCG_PQUEUE **pqueue) |
void | GCGpqueueClear (GCG_PQUEUE *pqueue) |
SCIP_RETCODE | GCGpqueueInsert (GCG_PQUEUE *pqueue, void *elem) |
void * | GCGpqueueRemove (GCG_PQUEUE *pqueue) |
SCIP_RETCODE | GCGpqueueResort (GCG_PQUEUE *pqueue) |
SCIP_RETCODE | GCGpqueueSetComperator (GCG_PQUEUE *pqueue, SCIP_DECL_SORTPTRCOMP((*ptrcomp))) |
SCIP_RETCODE | GCGpqueueDelete (GCG_PQUEUE *pqueue, int pos, void **elem) |
void * | GCGpqueueFirst (GCG_PQUEUE *pqueue) |
int | GCGpqueueNElems (GCG_PQUEUE *pqueue) |
void ** | GCGpqueueElems (GCG_PQUEUE *pqueue) |
Macro Definition Documentation
◆ PQ_PARENT
#define PQ_PARENT | ( | q | ) | (((q)+1)/2-1) |
Definition at line 54 of file gcgpqueue.c.
◆ PQ_LEFTCHILD
#define PQ_LEFTCHILD | ( | p | ) | (2*(p)+1) |
Definition at line 55 of file gcgpqueue.c.
◆ PQ_RIGHTCHILD
#define PQ_RIGHTCHILD | ( | p | ) | (2*(p)+2) |
Definition at line 56 of file gcgpqueue.c.
Function Documentation
◆ pqueueResize()
|
static |
resizes element memory to hold at least the given number of elements
- Parameters
-
pqueue pointer to a priority queue minsize minimal number of storable elements
Definition at line 61 of file gcgpqueue.c.
References GCG_PQueue::scip, GCG_PQueue::size, and GCG_PQueue::slots.
Referenced by GCGpqueueCreate(), and GCGpqueueInsert().
◆ pqueueHeapify()
|
static |
heapifies element at position pos into corresponding subtrees
- Parameters
-
pqueue pointer to a priority queue pos heapify element at position pos into corresponding subtrees
Definition at line 81 of file gcgpqueue.c.
References GCG_PQueue::len, PQ_LEFTCHILD, PQ_PARENT, PQ_RIGHTCHILD, and GCG_PQueue::slots.
Referenced by GCGpqueueResort().