span>)
0014     <span class="keyword">end</span>
0015     <span class="keyword">if</span> (~<a href="isconnected.html" class="code" title="function yn = isconnected(g)">isconnected</a>(g))
0016         error(<span class="string">'Input graph is not a tree'</span>)
0017     <span class="keyword">end</span>
0018     
0019     <span class="keyword">if</span> (n &lt; 2)
0020         error(<span class="string">'Algorithm applies only to trees with 2 or more vertices'</span>)
0021     <span class="keyword">end</s