/** * @license * Copyright Daniel Imms * Released under MIT license. See LICENSE in the project root for details. */ declare module '@tyriar/fibonacci-heap' { export type CompareFunction = (a: INode, b: INode) => number; export interface INode { key: K; value?: V; } /** * A Fibonacci heap data structure with a key and optional value. */ export class FibonacciHeap { /** * Creates a new Fibonacci heap. * @param compare A custom compare function. */ constructor(compare?: CompareFunction); /** * Clears the heap's data, making it an empty heap. */ clear(): void; /** * Decreases a key of a node. * @param node The node to decrease the key of. * @param newKey The new key to assign to the node. */ decreaseKey(node: INode, newKey: K): void /** * Deletes a node. * @param node The node to delete. */ delete(node: INode): void; /** * Extracts and returns the minimum node from the heap. * @return The heap's minimum node or null if the heap is empty. */ extractMinimum(): INode | null; /** * Returns the minimum node from the heap. * @return The heap's minimum node or null if the heap is empty. */ findMinimum(): INode | null; /** * Inserts a new key-value pair into the heap. * @param key The key to insert. * @param value The value to insert. * @return node The inserted node. */ insert(key: K, value?: V): INode; /** * @return Whether the heap is empty. */ isEmpty(): boolean; /** * @return The size of the heap. */ size(): number; /** * Joins another heap to this heap. * @param other The other heap. */ union(other: FibonacciHeap): void; } }