|
372 | 372 | QR=[R Qr']; |
373 | 373 | QRs=sortrows(QR,3,'descend'); |
374 | 374 |
|
| 375 | + Ord=[]; |
375 | 376 | for i=1:N |
376 | | - r=[]; |
377 | | - [r c]=find(QRs==i); |
378 | | - Ord(i)=r(1) ; |
| 377 | + temp=[];r=[];tempmax=[]; |
| 378 | + [r c]=find(QRs==i); |
| 379 | + temp=QRs(r,:); |
| 380 | + tempmax=max((QRs(r,3))); % BUGfix added 6 july |
| 381 | + [rx ~]=find(temp==tempmax) % |
| 382 | + Ord(i)=r(rx(1)); % |
379 | 383 | end |
380 | 384 | Ord=unique(Ord); % Remove dublicates |
381 | 385 | rr=find(Ord>length(R)); |
|
413 | 417 | Hh=unique(nonzeros(QM)); %Different frequencies |
414 | 418 | HH=sort(Hh,'descend'); |
415 | 419 |
|
416 | | - |
417 | 420 | CG=zeros(L,N); |
| 421 | + |
| 422 | +if numel(HH)>1 % Added to accomodate the possibility that all Louvain solutions create exactly the same TOP pairs |
| 423 | + |
418 | 424 | kk=[]; |
419 | 425 | TOP=[]; |
420 | 426 | TOPs=[]; |
|
438 | 444 | end |
439 | 445 | SumCG=max(CG'); |
440 | 446 | [r d]=find(SumCG'==min(SumCG)); |
| 447 | +rof=r(1); |
| 448 | + |
| 449 | +else % if all Louvain solutions give exactly the same TOP pairs |
| 450 | + rof=1; |
| 451 | +end |
441 | 452 |
|
442 | | -TOP=squeeze(QT(r(1),:,:)); |
443 | | -TOPS=squeeze(QRtopS(r(1),:,:)); |
| 453 | +TOP=squeeze(QT(rof,:,:)); |
| 454 | +TOPS=squeeze(QRtopS(rof,:,:)); |
444 | 455 | if S>1 |
445 | | - Louv=squeeze(Louvain_s(r(1),:,:,:)) |
| 456 | + Louv=squeeze(Louvain_s(rof,:,:,:)) |
446 | 457 | else |
447 | | - Louv(1,:,:)=squeeze(Louvain_s(r(1),:,:,:)); |
| 458 | + Louv(1,:,:)=squeeze(Louvain_s(rof,:,:,:)); |
448 | 459 | end |
449 | 460 |
|
450 | | -V=squeeze(Mean_matrix(r(1),:,:)); |
| 461 | +V=squeeze(Mean_matrix(rof,:,:)); |
451 | 462 | C=mean(mean(V))*diag(diag(V)); |
452 | 463 | V=V-diag(diag(V)); |
453 | 464 | V1=V+C; |
|
0 commit comments