function h = RD_node_degree(nei,max_d)
%

[num_nodes,dummy] = size(nei);
nei_bin = nei>0&nei<max_d;

h = zeros(num_nodes,1);

for n = 1:num_nodes
    count = sum(nei_bin(n,:));
    if count==0
        h(num_nodes) = h(num_nodes) + 1;
    else
        h(count) = h(count) + 1;
    end
end
