6 * $Date:2007-10-18 17:23:28 +0200 (Thu, 18 Oct 2007) $
7 ***************************************************************/
10 * \brief Declaration of an abstract heap base class for
11 * priority queue implementation.
13 * \author Karsten Klein
16 * This file is part of the Open Graph Drawing Framework (OGDF).
20 * See README.txt in the root directory of the OGDF installation for details.
23 * This program is free software; you can redistribute it and/or
24 * modify it under the terms of the GNU General Public License
25 * Version 2 or 3 as published by the Free Software Foundation;
26 * see the file LICENSE.txt included in the packaging of this file
30 * This program is distributed in the hope that it will be useful,
31 * but WITHOUT ANY WARRANTY; without even the implied warranty of
32 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
33 * GNU General Public License for more details.
36 * You should have received a copy of the GNU General Public
37 * License along with this program; if not, write to the Free
38 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
39 * Boston, MA 02110-1301, USA.
41 * \see http://www.gnu.org/copyleft/gpl.html
42 ***************************************************************/
49 #ifndef OGDF_HEAP_BASE_H
50 #define OGDF_HEAP_BASE_H
53 #include <ogdf/basic/GraphCopy.h>
60 * \brief A data structure implementing the abstract data type
62 * A Heap is a data structure implementing the abstract data type
63 * priority queue, maintaining a set of elements each with an associated key value
64 * used for keeping the elements in a specific order.
66 * It supports the following operations:
67 * insert(element, key) insert element with key in set
68 * min return element with minimum key
69 * extractMin remove and return element with minimum key
70 * decreaseKey decrease the key of a given element to a given value
71 * delete remove a given element fromthe structure
74 * Running times and space requirements are depending on the actual
75 * implementation type (e.g., binary, binomial or fibonacci heaps)
82 class HeapEntryPointer
;
84 template <class Priority
, class HeapObject
>
91 virtual ~HeapBase() { }
94 //! build a heap out of a given set of elements
95 virtual void makeHeap() = 0;
97 HeapObject
minRet() { }
99 //*******************************************************
102 //! insert a new element with priority key
103 virtual void insert(HeapObject
, Priority
/* key */) { }
105 //derived classes should decide themselves if they have
106 //a specific delete function
107 //virtual void delete() = 0;
109 //! update the data structure by decreasing the key of an object
110 //TODO: Does not make much sense without an object parameter
111 virtual void decreaseKey() { }
113 //*******************************************************
115 int size() const {return m_size
;}
117 bool empty() const {return m_size
==0;}
121 int m_size
; //number of elements stored in heap