Here's how to write the results to file as they are found. I can't be sure if this will solve your memory problem as I have not run it for long enough.

The original code uses Sow to collect the results. All that is required is to replace Sow with a Write statement, plus code to open and close the file stream.

I have also made a couple of other minor changes:


I converted the XLSX file to CSV (in Excel) so that it can be loaded without mucking about with the Java stack size. 
I didn't see any point in importing an adjacency matrix, converting it to a graph, and then feeding it into a function which converts it back to an adjacency matrix. So I used just the matrix version of findPaths.
I call the recursive find function inside a Block with $RecursionLimit set to infinity, to allow for paths of any length.


.

data = Import["test.csv"];

writePaths[a_?MatrixQ, s_Integer, t_Integer, file_] :=
 Module[{child, find, stream},
  stream = OpenWrite[file];
  child[v_] := Flatten@Position[a[[v]], Except@0, 1, Heads -&gt; False];
  find[v_, list_] := Scan[If[# === t,
      Write[stream, Append[list, #]],
      If[FreeQ[list, #], find[#, Append[list, #]]]] &amp;, child@v];
  Block[{$RecursionLimit = Infinity}, find[s, {s}]];
  Close[stream]]

writePaths[data, 1, 542, "paths.txt"];


Writing results directly to file
In my field, good journals often seem to take around 12-20 weeks to review papers. As was suggested in a previous post, "How is it in my best interest not to submit a paper to two journals simultaneously?," one should not submit same paper to two journals. But none is omniscient to do multiple papers on various topics. Can any one kindly suggest how to speed up the publication process? Can journals reduce time? Or is this suggestion acceptable only after acceptance?
