Refactor and implement GENERATE-WORD-NEIGHBOURS-GRAPH