title: Distinguish Graph from Tree using Adjacency Matrix
body: <p>Given an adjacency matrix, is there a way to determine if the graph will be a tree or a graph (whether or not there is a cycle).</p>
  
  <p>For example, given the adjacency matrix:</p>
  
  <pre><code>0 1 0 1
  1 0 0 1
  0 0 0 1
  1 1 1 0
  </code></pre>
  
  <p>This is not a tree since there is a cycle between Vertex 1, Vertex 2 and Vertex 4.</p>
  
  <p>Whereas given the adjacency matrix:</p>
  
  <pre><code>0 0 0 1
  0 0 0 1
  0 0 0 1
  1 1 1 0
  </code></pre>
  
  <p>This is a tree since there is no cycle.</p>
  
  <p>One way to approach this is to perform a BFS but I think there might be a visual difference between an adjacency matrix of a graph and of a tree.</p>
  
  <p>Any help would be appreciated!</p>