About
This mini-project was inspired by a game that we used to play in high school whenever the class would visit the computer lab. Called the Wikipedia Game, you try to go from one random page to another as quickly as possible by clicking article links on the page. This was fun and when I later got into programming, it occurred to me it was an interesting graph problem given the sheer size of Wikipedia.
Some facts about the size of Wikipedia:
- The entire text of the English language Wikipedia fits on a thumbdrive (~27 GB - doesn't include images).
- Uncompressed this grows to ~118 GB of XML.
- There are >7 million articles listed.
I used Claude to transform the raw Wikipedia dump into a format which could be easily traversed as a graph and stored on disk. The methods Claude used were enlightening and admittedly not the routes I would've first pursued, so I was glad to save myself the time, the errors, and learn a thing or two.
One interesting thing from Claude's implementation was the Compressed Sparse Row (CSR) format for graphs, which is more space efficient and faster to query than a traditional adjacency matrix.
The one portion of this project I did want to hand code myself was the search algorithms. The naive first approach was Breadth First Search (BFS). While guaranteed to find an optimal solution, it's incredibly slow. The gold standard for these kinds of search space problems is a Bidirectional BFS, where you kick off a BFS from the source node, another from the destination node, and wait until they meet in the middle. This cuts down on the total nodes explored and makes searching a graph of 7M nodes feasible.
Lastly I used Claude to create a frontend and API server for this project. The frontend showcases a visualization of the search by demonstrating where on each page you can click to get from Page A to Page B.
For more implementation details and how to clone+build yourself, see the project here: https://github.com/QuinnMcHugh/WikipediaGame