DFS can be used for traversal.
ok, but i am asking is DFS can be used as " finding shortest path between two vertices if graph is unweighted and connected "
Should be NO...
let K$_3$ is a complete undirected graph, then by applying DFS, you got as
1-->2 -->3, this indicates shortest path between 1 and 3 is 2 edge long, but it is not true !
if you apply BFS, then it will say, 1-->2 and 1-->3 ==> correct !
Coming to Prims(krushkal), if all edges are equal weight (i.e., indirectly it is saying unweighted), they may result more than one Spanning tree, So we can't guarantee that " it will result shortest path between any vertices at any time. "