% plot_spanning_tree.m
% Given tree (in linear format; tree(k) gives the index of
% the parent vertex of k) and verts, plot the tree.

function plot_spanning_tree(tree,verts)
   K=length(tree);
   for k=2:K
       x1=verts(k,1);
       y1=verts(k,2);
       x2=verts(tree(k),1);
       y2=verts(tree(k),2);      
       plot([x1;x2],[y1;y2],'r','LineWidth',2);
   end % for k 
   % plot starting point
   scatter(verts(1,1),verts(1,2),'k','filled');
return