
function a = area(f, R, parent)
    a = ones(size(R));
    
    [_, v] = sort(R(:));
    
    for x = v'
        if parent(x) == x
            continue
        end
        
        a(parent(x)) = a(parent(x)) + a(x);
    end
end
