select a subgraph with only paths that connects a source to a sink with at most N vertices

I have a source and a sink vertex and I would like to extract a subgraph from the original graph that is constituted by vertices that allow only paths between the source and the sink with at most N vertices. Do you think is it possible to define it properly with igraph functions?

It’s not quite clear to me what you mean, but this function may help:

If it does not, please show a concrete example: (1) this is my input graph, with source and sink (2) this is the desired output.

thanks for the link very useful, but I am not 100% sure that could be the complete answer.
Here below an example of a graph in which I would like to have, for example, the subgraph that connects node 29 as source and 14 as sink but with at most 3 steps (29-27-24-14 for example). Therefore I would like to get rid in the subgraph of, for example 1 to 10 nodes and so on.