[GRASS-user] least cost path between patches

Dear listers,

I am trying to compute and represent the least cost paths between discrete patches (say distribution areas of a given species included in a landscape matrix). For training, I use a homogeneous cost surface (the landscape matrix, 'movecost') and a raster 'monkeygroup' of 12 discrete patches representing the species areas (1 for pixels on the patch, NULL out).

r.mapcalc "movecost=1.0"

I can easily get a distance map 'monkeycost' then,

r.cost input=movecost output=monkeycost start_rast=monkeygroup

Now, I would like to find out the shortest track(s) linking each patch to the others, and here I am stuck. r.drain supposes that one uses one geographical coordinate as a starting point. However I would like to link the nearest pixels belonging to each patch via a path that must go away from one patch, go up to the lowest local maximum and then go down to the next patch. This supposes that one can identify which pixels included are the nearest among two patches, and then compute the path... (hope it is understandable).

Is there any grass module doing the job, or has anybody an idea about a strategy to get the expected result?

Patrick