in reply to find all paths of length n in a graph

There's a boggle game in the bsd-games package which is pre-installed on many linux systems or can be installed with the packaging system. You may want to look at or even use its C source.

Update: boggle even has a batch mode when you don't play the game, only get the words in a table you specify.

boggle -b 'atrieynnilsoelxw' </usr/share/games/bsd-games/boggle/dictio +nary