public void remove() {
        if (this.root != null) {

            FibonacciHeapNode beforeHighestPriority = this.root;
            FibonacciHeapNode root = this.root.next;

            if (root == null) {
                this.root.tree.remove();
            } else {
                do {
                    if (beforeHighestPriority.tree.top().value.compareTo(root.tree.top().value) < 0) {
                        beforeHighestPriority = root;
                    }

                    root = root.next;
                } while (root != null);

                beforeHighestPriority.tree.remove();
                if (beforeHighestPriority.tree.top() == null) {
                    beforeHighestPriority = beforeHighestPriority.next;
                }
            }

            if (this.root.tree.top() == null && this.root.next != null) {
                this.root = this.root.next;
            }

            merge(this.root);
        }
    }