Question: Help Boggle translate to maple from mathematica

Could anyone help to translate this (below) into Maple.  The Mathematica code understanding is causing me frustrations.  I got about as far as just starting to create the boggle board with the GraphTheory package. Here's what I have,which is rally barely anything at all. My example board 3x4
a := Graph(undirected, {["a", "b"], ["a", "e"], ["b", "c"], ["b", "e"], ["b", "f"], ["c", "f"], ["d", "a"], ["d", "b"], ["d", "e"], ["d", "g"], ["d", "h"], ["e", "c"], ["e", "g"], ["e", "h"], ["e", "i"], ["f", "e"], ["f", "h"], ["f", "i"], ["g", "h"], ["g", "j"], ["g", "k"], ["h", "j"], ["h", "k"], ["h", "l"], ["i", "h"], ["i", "k"], ["i", "l"], ["j", "k"], ["k", "l"]})

DrawGraph(a, style = spring)

Obviously there must be a better way to create than to individually type out the verticies.  But then, I am lost.
It is at the bottom of this link mathematica.stackexchange.com/questions/5387/how-can-i-use-mathematicas-graph-functions-to-cheat-at-boggle

Here's the section:

Boggle grids are square. The adjacency matrix has a nice structure to it, which allows you to construct it neatly for any   grid. Here's the function to create it:

boggleAdjMatrix[n_]:=Module[{grid, diag, patt, eye}, grid =SparseArray[{Band[{1,1}]-> patt,Band[{2,1}]-> eye,Band[{1,2}]-> eye},{n, n}]//Normal; diag =SparseArray[{Band[{2,1}]-> patt,Band[{1,2}]-> patt},{n, n}]//Normal; patt =SparseArray[{Band[{2,1}]->1,Band[{1,2}]->1},{n, n}]//Normal; eye =IdentityMatrix[n];ArrayFlatten[grid + diag]//Unitize]

Now for the above board of letters, you can create the graph from the adjacency matrix, and simply label the vertices (s is the string in your first code block, just copy-pasted):

With[{letters =StringSplit[s]},AdjacencyGraph[boggleAdjMatrix[Sqrt[Length@letters]],VertexLabels->Table[i -> letters[[i]],{i,Length@letters}]]]

enter image description here

You can also get the matrix from your approach by calling AdjacencyMatrix[graph], but I find this easier to follow.

I create some helper functions to create a smaller dictionary of valid words, to check if a word is in that dictionary, to test whether a given path could ever lead to a word, and to sow a word that is legal

Clear[dictionary, wordQ, proceedQ, sowWord] dictionary[list_List]:=With[{chars =DeleteDuplicates@list},DictionaryLookup[x : chars .../;StringLength[x]>=3,IgnoreCase->True]]; wordQ[dict_List,word_String]/;StringLength[word]>=3:=Or@@StringMatchQ[dict, word] proceedQ[dict_List,word_String]:=Or@@StringMatchQ[dict, word ~~___] sowWord[dict_List,s_String]/;StringLength[s]>=3:=Sow[s]/; wordQ[dict, s]

For the adjacent nodes, instead of using NeighborhoodGraph repeatedly, I create a list of adjacent nodes, which you can easily get from the adjacency matrix:

adjNodes =With[{list =First/@ArrayRules[boggleAdjMatrix[4]]//Most},Map[Last,SplitBy[list,First],{2}]]

Now you can simply index the  th element to get the neighbours. For example, adjNodes[[10]] gives you {5, 6, 7, 9, 11, 13, 14, 15}.

With the above, we're all set to find the words. First a couple of initializations:

letters ={"F","X","I","E","A","M","L","O","E","W","B","X","A","S","T","U"}; dict =ToUpperCase@dictionary[letters]; currentWord[visited_List]:=StringJoin@@ letters[[visited]];

The following is the main function that traverses the graph starting from a given vertex. It moves forward only if the word in the current path could ever lead to a word at a future node.

Clear[stepForward] stepForward[current_,visited_:{}]:=Module[{$visited, $currentWord},With[{$possibleNodes =DeleteCases[adjNodes[[current]],Alternatives@@ visited]}, $visited =Append[visited, current]; $currentWord = currentWord[$visited]; sowWord[dict, $currentWord]; stepForward[#, $visited]&/@ $possibleNodes /; proceedQ[dict, $currentWord]]]

And finally, run it on the entire graph:

wordsFromVertex[v_]:= stepForward[v]//Reap//Last wordsFromVertex /@Range[16](* {"FAX", "FAME", "XML", "IMF", "ELI", "ELM", "ELMA", "AXLE", "AMIE", "AMBLE", "AWL", "AWE", "AWES", "MIX", "MIL", "MILE", "MILO", "MAX", "MAXI", "MAE", "MAW", "MAWS", "MEW", "MEWL", "MEWS", "MES", "MESA", "LIE", "LIMA", "LIME", "LIMES", "LIMB", "LIMBO", "LIMBS", "LEI", "LEO", "LOB", "LOBS", "LOX", "OIL", "OLE", "EMIL", "EMILE", "EAST", "WAX", "WEST", "WAS", "WAST", "BMW", "BOIL", "BOLE", "BOX", "BUT", "BUTS", "AWL", "AWE", "AWES", "SEA", "SEAM", "SEMI", "SEW", "SEA", "SWAM", "SWAMI", "SAW", "STU", "STUB", "TWA", "TWA", "TWAS", "TUB", "TUBS", "TUX"} *)
Please Wait...