From 6c340dcefd0e8761e3fbdc530ac23091100fdb8c Mon Sep 17 00:00:00 2001 From: David Nolte Date: Mon, 1 Feb 2021 11:02:34 -0500 Subject: [PATCH] Create eigenlap.m --- eigenlap.m | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 eigenlap.m diff --git a/eigenlap.m b/eigenlap.m new file mode 100644 index 0000000..f5f421a --- /dev/null +++ b/eigenlap.m @@ -0,0 +1,27 @@ +% function [synch,l2,lmax,spec] = eigenlap(node) +% Calculates the eigenvalues 2 and N +% synch = ratio l2/lmax gives measure of synchronizabity +% spec is the full spectrum + + +function [synch,l2,lmax,spec] = eigenlap(node) + +[A,degree,Lap] = adjacency(node); + +[dum,N] = size(Lap); +l = eig(Lap); +spec = l; + +flag = 0; ind = 1; +while flag == 0 + ind = ind + 1; + l2tmp = min(l(ind:N)); + if l2tmp > 1/sqrt(N) + l2 = l2tmp; + flag = 1; + end +end + + +lmax = l(N); +synch = lmax/l2;