function pageranks = sparse_pageranks(A, b=0.8)
  
  num_nodes = size(A,1);
  pageranks = ones(1, num_nodes) / num_nodes;
  
  degrees = full(sum(A,2));
  D=sparse(1:num_nodes, 1:num_nodes, 1./degrees);
  M = D * A;
  
  for iter=1:500
    old_pageranks = pageranks;
    pageranks = pageranks * M;
    difference = norm(pageranks - old_pageranks);
    fprintf("delta=%f @iter.%d\n", difference, iter)
    if difference < 1e-4
      break
    endif
  endfor
endfunction
