clear
N_ref=4;
M_ref=[0,1,1,0;1,0,1,1;1,1,0,1;0,1,1,0];
A_ref=[1,2;1,3;2,3;2,4;3,4];
L_ref=[2,3,0;1,3,4;1,2,4;2,3,0];
disp(N_ref);
disp(M_ref);
disp(A_ref);
disp(L_ref);

function [M]=listadjTOmatadj(N,L)
    M=zeros(N,N);
    for(j = 1:N)
        for(i = 1:size(L,2)) //size(L,2) donne le nombre de colonnes 
            k = L(j,i);
            if k>0 then M(j,k)=1;
             M(k,j)=1;
            end
        end
    end
endfunction
M=listadjTOmatadj(N_ref,L_ref);
disp(M);

function [L]=matadjTOlistadj(N,M)
    L=zeros(N-1,N)
    for(i=1:N)
        for(j=1:N)
            if(M(i,j)==1) then L(i,j)=j;
            end
        end
    end
endfunction
L=matadjTOlistadj(N_ref,M_ref);
disp(L);
