This isn't the whole solution, but I think it is the start of one. First, computing the distance matrix will probably be helpful.
> x <- c(1,4,5,8,9)
> dx <- dist(x)
> dx
1 2 3 4
2 3
3 4 1
4 7 4 3
5 8 5 4 1
Second, you can identify points which are the same distance apart by sorting the distances and run-length encoding them.
> rdx <- rle(sort(dx))
> rdx
Run Length Encoding
lengths: int [1:6] 2 2 3 1 1 1
values : num [1:6] 1 3 4 5 7 8
you can select the set of points you want and then get back to the indices in the original distance matrix using the order function. Taking the third group -- of points separated by distance 4 -- as an example
> i=3
> orderedIndex <- sum(rdx$lengths[1:(i-1)])
> order(dx)[(orderedIndex+1):(orderedIndex+rdx$lengths[i])]
[1] 2 6 9
(the indices count from the top down then from left to right). So here you have identified the 4s in the distance matrix: these are distances between the 1st/3rd, 2nd/4th, and 3rd/5th points in x. But you still have to do some more work to eliminate the 2nd and 4th points. Presumably you choose the 1st, 3rd and 5th points because they are connected?
I think you would want to process all groups of points identified by the rle function as over your chosen size, and then check for connectivity.