function UnusedEdges  = UnusedEdgeFinder(EdgeListG, EdgeListT, BdyEdges)
% UnusedEdges  = UnusedEdgeFinder(EdgeListG, EdgeListT, BdyEdges)
%We first form the UnusedEdges to be those edges of G that do not appear
%as tree edges, and do not appear as boundary edges.  Note that once a 
%boundary edge has been added, it can be deleted, but will never be added a 
%second time.
UnusedEdges = setdiff(EdgeListG, EdgeListT, 'rows');
UnusedEdges = setdiff(UnusedEdges, BdyEdges, 'rows');
%We also need to delete any edge from UnusedEdges both of whose endpoints
%are in the tree (These edges have not yet been accounted for, and will
%subsequently never be boundary edges.)
[r c] = size(UnusedEdges);
CycleEdge = []; %this vector will collect all Unused edges both of whose
%endpoints are tree endpoints, and thus would form a cyle in in T
EdgeListTEndpts = EdgeListT(:,1:2);
for i = 1:r
    if ismember(UnusedEdges(i,1),EdgeListTEndpts) & ismember(UnusedEdges(i,1),EdgeListTEndpts)
            CycleEdge = [CycleEdge i];
    end
end
UnusedEdges(CycleEdge,:)=[];