public Fibonaccinode extract_min() {
     Fibonaccinode z = min;
        if (z != null) {
            int children = z.degree;
            Fibonaccinode x = z.child;
            Fibonaccinode temporary;
            while (children > 0) {
                temporary = x.right;
                x.left.right = x.right;
                x.right.left = x.left;
                x.left = min;
                x.right = min.right;
                min.right = x;
                x.right.left = x;
                x.parent = null;
                x = temporary;
                children--;
            }
            z.left.right = z.right;
            z.right.left = z.left;
            if (z == z.right) {
                min = null;
            } else {
                min = z.right;
                consolidate();
            }
            size--;
        }
        return z;
    
 }