function dergraph(x,m)

%plots values made by 'ds' (see comments in that file) over their corresponding edges in the SG graph
%after Delta-Y transformations on each cell.

q0=[1/2 1]; q1=[0 0]; q2=[1 0];
y=[];
d=ds(x,m,.0001);
%d=log(d);
s=size(d);
s=s(1);
v=[1/2 3/4; 1/4 1/4; 3/4 1/4];
y=v;

for i=1:1:m
    y=[wordm(y,q0); wordm(y,q1); wordm(y,q2)];
end
%plot3(y(:,1),y(:,2),d(:,1),'.')
hold off

for n=1:1:3^(m)
    hold on
    
    plot3([y(3*n-2:3*n,1); y(3*n-2,1)],[y(3*n-2:3*n,2) ;y(3*n-2,2)] ,[d(3*n-2:3*n,1); d(3*n-2,1)], 'color', 'r')
end