Word Chain Solver computes the minimal number of changes from one word to another by changing only one letter at a time. It will also generate a DOT file for analysis. See This Video for a full overview.
There is a default dictionary included sourced from http://wordlist.aspell.net/12dicts/
However, you may use any dictionary by replacing the word list file WORD_LIST
with your own.
By default, word lengths are 3 letters, but you can change WORD_LEN
to any number.
Once the dictionary and word length are set, just run python WordChainSolver.py
to begin. You can choose 2 words and the program will print the optimal path to get there. It will also generate the graph.dot file.
WARNING: The word list included here is completely unfiltered and may include slurs and other offensive words. You should consider using a different dictionary if you need everything clean.
If you'd like to make graphs like the video, follow these steps.
- Download and install Gephi
- Open Gephi and load the DOT file 'graph.dot'.
- In the layout tab, select ForceAtlas 2
- In the ForceAtlas 2 settings, Enable the option "Stronger Gravity" and set the "Gravity" to 0.02
- Press Run and watch the graph form.
- Once the graph has mostly stopped moving, enable the "Prevent Overlap" option.
- Press Stop to end the layout changes.
- In appearance, under "Ranking", choose "Degree" and then choose a color palette. Then press Apply
- In the Graph window press the icon that looks like a T to Show Node Labels.
- Adjust the size of the labels with the slider until they fit in the nodes.
- Adjust the color of the labels so they contrast well with the node colors.