function [R] = Resistance(Matrix)
%The input Matrix is a Laplacian Matrix of a graph and the output R is the
%resistance matrix of the graph.
[m,n]=size(Matrix);
R=zeros(m,m);
%This block of code finds the resistance between each pair of vertices in
%the upper diagonal part of Matrix. Each entry in the lower diagonal part
%is equal to the corresponding entry in the upper diagonal part. The
%entries on the diagonal are simply zero.
for k =1:m-1
for l=k+1:m
H=Harmonic(Matrix,k,l);
%H is the harmonic function corresponding to vertices k and l.
%The function Harmonic is called upon.
R(k,l)=(Energy2(H,Matrix))^-1;
%The function Energy2 is called upon to find the resistance
%between vertices k and l.
R(l,k)=R(k,l);
end
end
end