You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CalcAffinityByKatzBeta_Sparse.m 869B

5 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. function [ affinity ] = CalcAffinityByKatzBeta_Sparse( data, beta, infinity, num_attr_nodes )
  2. %sigal
  3. if num_attr_nodes>0
  4. extraLen=0;
  5. else
  6. extraLen=0;
  7. end
  8. infinity = infinity+extraLen;
  9. %data(eye(size(data,1)) == 1) = 1;
  10. start_beta = beta;
  11. d_next = data;
  12. affinity = sparse(d_next .* beta);
  13. if num_attr_nodes>0
  14. d_next(1:num_attr_nodes,:)=0;
  15. d_next(:,1:num_attr_nodes)=0;
  16. end
  17. d_next = sparse(d_next);
  18. for n = 2 : infinity
  19. d_next = sparse(d_next * data);
  20. beta = beta * start_beta;
  21. affinity = sparse(affinity + (d_next .* beta));
  22. end
  23. %sigal 29.10.13 - normolize by diagonal min
  24. v = diag(affinity);
  25. max_val = min(v);
  26. %max_val = max(max(affinity));
  27. affinity = affinity ./ max_val;
  28. for i = 1 : size(affinity,1)
  29. affinity(i,i) = 1;
  30. end
  31. %sigal 29.10.13 - end
  32. end %function