function D=ds(x,m,t)
%give a 3^m by 3 matrix, where each row is the set of resistances on the edges of a
%cell, and this will compute the derivatives of the resistances of the
%restricted graph with respect to perturbing each edge individually by a
%small t.
D=[];
s=size(x);
s1=s(1); s2=s(2);
for i=1:1:s1
    for j=1:1:s2
    y=restrict(x,m,0);
    yt=restrict(x+t*omatrix(x,i,j),m,0);
    D=[D ; (yt-y)./t];
    end
end


