function [G,XY] = getgraphDoublering(nnod); % creates the graph of "ring" topology with (nnod) nodes: al = 0:2*pi/(nnod-1):2*pi-1e-10; XY = [cos(al),0; sin(al),0]'; G = sparse([1:nnod,nnod],[2:nnod,1,round(nnod/2)],1,nnod,nnod); G = spones(G+G'); G = G-spdiags(diag(G),0,nnod,nnod); %G(3,9)=1;G(3,5)=1; %%% you must choose which links have to be added %G(3,1)=1;G(1,3)=1;