+/**
+ * @brief Extracts from the heap and returns the element at position i.
+ * \param H the heap we're working on
+ * \param i element position
+ * \return the element at position i if ok, NULL otherwise
+ *
+ * Extracts from the heap and returns the element at position i. The head is automatically reorded.
+ */
+void *xbt_heap_remove(xbt_heap_t H, int i)
+{
+ if ((i < 0) || (i > H->count - 1))
+ return NULL;
+ /* put element i at head */
+ if (i > 0) {
+ KEY(H, i) = MIN_KEY_VALUE;
+ xbt_heap_increaseKey(H, i);
+ }
+
+ return xbt_heap_pop(H);
+}
+