algorithm for connectivity by path of given length
The problem is NP-complete and referred to as Longest Path.  It is FPT, though, so you can solve it in time polynomial in $n$ for fixed $k$.
If you want to solve it in FPT time, the easiest solution is to do color coding.  The trick is two-fold.

Suppose that vertices are colored with $k$ colors, and you are looking for a rainbow-path of length $k$, i.e. a path where every vertex has different color.  This problem can be solved by dynamic programming!

Repeat the following step: Randomly color the vertices of the graph with $k$ colors, and run the rainbow algorithm.


With probability depending only on $k$, if there exists a $k$-path, then you will output a rainbow path.