Skip to content

Commit 55bf608

Browse files
Add files via upload
1 parent e5005ee commit 55bf608

1 file changed

Lines changed: 20 additions & 9 deletions

File tree

TimeResolvedNets.m

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -372,10 +372,14 @@
372372
QR=[R Qr'];
373373
QRs=sortrows(QR,3,'descend');
374374

375+
Ord=[];
375376
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)); %
379383
end
380384
Ord=unique(Ord); % Remove dublicates
381385
rr=find(Ord>length(R));
@@ -413,8 +417,10 @@
413417
Hh=unique(nonzeros(QM)); %Different frequencies
414418
HH=sort(Hh,'descend');
415419

416-
417420
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+
418424
kk=[];
419425
TOP=[];
420426
TOPs=[];
@@ -438,16 +444,21 @@
438444
end
439445
SumCG=max(CG');
440446
[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
441452

442-
TOP=squeeze(QT(r(1),:,:));
443-
TOPS=squeeze(QRtopS(r(1),:,:));
453+
TOP=squeeze(QT(rof,:,:));
454+
TOPS=squeeze(QRtopS(rof,:,:));
444455
if S>1
445-
Louv=squeeze(Louvain_s(r(1),:,:,:))
456+
Louv=squeeze(Louvain_s(rof,:,:,:))
446457
else
447-
Louv(1,:,:)=squeeze(Louvain_s(r(1),:,:,:));
458+
Louv(1,:,:)=squeeze(Louvain_s(rof,:,:,:));
448459
end
449460

450-
V=squeeze(Mean_matrix(r(1),:,:));
461+
V=squeeze(Mean_matrix(rof,:,:));
451462
C=mean(mean(V))*diag(diag(V));
452463
V=V-diag(diag(V));
453464
V1=V+C;

0 commit comments

Comments
 (0)