Correctness of Algorithm for Computing Diameter of a Graph
It works for trees (although it can be simplified).  However, on general graphs it does not work.

If your arbitrary vertex $v$ is the one on the top (labeled 1), then the Temp={8,9}.  However, the unique diameter path is from 7 to 6.