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.

CalcPHsAffinityByRCN_samiA.m 1.2KB

12345678910111213141516171819202122232425262728293031323334
  1. function [ affinity ] = CalcPHsAffinityByRCN( data, actual_graph_size, num_missing_nodes)
  2. % sigal 29.10.13
  3. % based on CalcAffinityByCommonNeighbors_Sparse
  4. %since missing nodes are only connected to one node we will artificially
  5. %connect them to their only neighbor's neighbors, and keep the connection to
  6. %the neighbor itself.
  7. if nargin > 1
  8. data = ConnectMissingNodesToNeighborsNeighbors(data, actual_graph_size, num_missing_nodes);
  9. end
  10. firstPH = actual_graph_size-num_missing_nodes+1;
  11. % give the #common neighbors per node pair (nxn)
  12. % sigal - oct 12 - bug fix by ron - include the node itself as its friend
  13. affinity = data(firstPH:end,:) * data(:,firstPH:end) + data(firstPH:end,firstPH:end)*2;
  14. s_rows = sum(data(:,firstPH:end)) + 1; % give the #neighbors per PH node (nx1)?
  15. %%s_cols = sum(data,2);
  16. affinity = NormalizeCommonNeighbors(affinity, s_rows); %new mex function
  17. %sigal 29.10.13 - normolize by diagonal min
  18. v = diag(affinity);
  19. max_val = min(v);
  20. %max_val = max(max(affinity));
  21. affinity = affinity ./ max_val;
  22. for i = 1 : size(affinity,1)
  23. affinity(i,i) = 1;
  24. end
  25. %sigal 29.10.13 - end
  26. end