In this paper we consider wireless cooperative multihop networks, where nodes that have decoded the message at the previous hop cooperate in the transmission toward the next hop, realizing a distributed space-time coding scheme. Our objective is finding optimal cooperator selection policies for arbitrary topologies with links affected by path loss and multipath fading. To this end, we model the network behavior through a suitable Markov chain and we formulate the cooperator selection process as a stochastic shortest path problem (SSP). Further, we reduce the complexity of the SSP through a novel pruning technique that, starting from the original problem, obtains a reduced Markov chain which is finally embedded into a solver based on focused real time dynamic programming (FRTDP). Our algorithm can find cooperator selection policies for large state spaces and has a bounded (and small) additional cost with respect to that of optimal solutions. Finally, for selected network topologies, we show results which are relevant to the design of practical network protocols and discuss the impact of the set of nodes that are allowed to cooperate at each hop, the optimization criterion and the maximum number of cooperating nodes.