% test if a graph is a tree

function ans=is_tree(G)
    V=size(G,1);
    E=sum(sum(G))/2;
    ans1=is_connected(G);
    if (ans1==1)&(E==V-1)
      ans=1;
    else
      ans=0;
    end
return 
