title: Determining whether or not a directed or undirected graph is a tree
body: <p>I would like to know of a fast algorithm to determine if a directed or undirected graph is a tree.</p>
  
  <p><a href="https://stackoverflow.com/questions/8367485/best-algorithm-to-determine-if-an-undirected-graph-is-a-tree">This</a> post seems to deal with it, but it is not very clear; according to this link, if the graph is acyclic, then it is a tree. But if you consider the directed and undirected graphs below: in my opinion, only graphs 1 and 4 are trees. I suppose 3 is neither cyclic, nor a tree. </p>
  
  <p><img src="https://i.stack.imgur.com/5xkVt.png" alt="enter image description here"></p>
  
  <p>What needs to be checked to see if a directed or undirected graph is a tree or not, in an efficient way?  And taking it one step ahead: if a tree exists then is it a binary tree or not?</p>