title: Applying bfs on a tree to find the longest path between two vertices
body: <p>In a tree I have to find two vertices which have maximum number of vertices between them (connected) including both of them. Then I need to find the total number of vertices between them. I want to approach this problem using Breadth first search algorithm, but not getting any clue. How to handle this?</p>
  
  <p>example(for 5 nodes)- the tree links are:</p>
  
  <p>1-2</p>
  
  <p>1-3</p>
  
  <p>3-4</p>
  
  <p>3-5</p>
  
  <p>then the longest path is
  2-1-3-4 or 2-1-3-5
  thus this path has in total 4 vertices.</p>