function minimaltree=min_tree(nb,ne,res,f1,f2,FontSize,LineWidth,MarkerSize);
n=res.dnei;
col=res.col;
a=res.matr;

global peremesh;
if isempty(peremesh)
    peremesh=0;
end
if (peremesh==1)
    a=peremesh_matrix(a);
end


str=res.str;
logm=zeros(ne-nb+1,col);
for j=1:col
    for i=nb:ne
        logm(i-nb+1,j)=log(a(i,j))-log(a(i-1,j));
    end
end

R=[];
R=corrcoef(logm);
R=replaceNAN(R);
dist=[];
dist=sqrt(2*(1-R));
dist=real(dist);
R1=[];
R1=prim2(dist);
hold on;

d=zeros(1,col);%Array of degrees in a graph.

for i=1:col
    d(i)=0;
    for j=1:col
        if i~=j & R1(i,j)~=inf
        d(i)=d(i)+1;
        end
    end
end
max=0;
nmax=1;
for i=1:col		%Determining the max degree
    if (d(i)>max)
        max=d(i);
        nmax=i;
    end
end		
p=[];
mn=[];
global mintreetype;

if mintreetype==1%MinTypeHier
    [mn,x,xx]=pplot_piram(R1,str,nmax,pi*2,f1,f2,mn,col,FontSize,LineWidth,MarkerSize);
else 
    %[mn,x,xx]=pplot_branches(R1,str,0,0,0,nmax,0,0,pi*2,f1,f2,1,mn);
    [mn,x,xx]=pplot_branches2(R1,str,nmax,pi*2,f1,f2,mn,col,FontSize,LineWidth,MarkerSize);
end
minimaltree=mn;
