Algorithm to get any spanning tree not necessarily a minimum spanning tree Is there an algorithm to find a spanning tree. I know that there are $n^{n-2}$ of them and we have algorithms to find a minimum spanning tree.

But what if I just want any spanning tree? It doesn't have to be minimum.

For a graph with no edge weights, should I just assume that the edge weights are all 1 and then use a Kruskal's or Prim's algorithm for minimum spanning tree?
Use the BFS or the DFS algorithms. They work in $O(n)$ and output a spanning tree if the input is a connected graph