- C# 97.7%
- Nix 2.3%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
- WGRF: add the optional view_count node column (id 18), filled from every
clickstream row; spec, writer, reader and builder updated
- path: new strategies followed (default), popular, niche-clicks and
niche-views next to shortest and niche; each page shows its score
- path strategies are now PathStrategy objects listed in PathStrategies;
PageCostStrategy adds a per-page-count strategy in one entry
- new `strategies` command describing each path strategy
- explore: --strategy followed puts a page under its most clicked parent
- info: most clicked links and most viewed pages
- move path code to Analyze/Paths/{Strategies,Algorithms} and mirror the
source folders in the test project, with shared graphs in Support/
- docs: path search, command reference, development
|
||
| .config | ||
| .forgejo/workflows | ||
| docs | ||
| WikipediaPath.GraphBuilder | ||
| WikipediaPath.GraphBuilder.Tests | ||
| .gitignore | ||
| AGENTS.md | ||
| CLAUDE.md | ||
| deps.json | ||
| flake.lock | ||
| flake.nix | ||
| global.json | ||
| LICENSE | ||
| README.md | ||
| renovate.json | ||
| wikipedia-path.slnx | ||
Wikipedia Path
Wikipedia Path turns French Wikipedia into a graph of links and finds chains of clicks between two articles: the one readers follow most, the shortest, or one through popular or little-known pages.
$ WikipediaPath.GraphBuilder path "Tour Eiffel" "Pikachu" --strategy shortest
Searched 99,483 pages in 30 ms.
2 clicks from 'Tour Eiffel' to 'Pikachu':
0. Tour Eiffel
1. Jeu vidéo
2. Pikachu
The graph is a single binary file in the WGRF format: 2.8 million articles and 235 million links in about 1.1 GB, memory-mapped and ready for breadth-first search.
Quick start
You need Linux, Nix with flakes, and about 80 GB of free disk.
nix develop # .NET 10, MariaDB, mdbook, profilers
db-start # local MariaDB in .mariadb/
alias wpath='dotnet run --project WikipediaPath.GraphBuilder --'
wpath download # Wikipedia dumps + Wikidata categories into dumps/
wpath decompress
wpath provision # load the SQL dumps into MariaDB (takes hours)
wpath build # write dumps/graph.wgrf
wpath info # summary and consistency checks
wpath path "Tour Eiffel" "Pikachu"
wpath explore "Pikachu" --max-depth 1
By default, path follows the links readers click most, from the Wikipedia clickstream.
--strategy shortest gives the fewest clicks instead, and popular, niche, niche-clicks and
niche-views go through popular or little-known pages. explore puts each page under the link
readers click most; --strategy first-found keeps the plain breadth-first tree.
path and explore can skip date pages (1913, 14 juillet) and countries (France) with
--exclude-date-page and --exclude-country.
Commands
| Command | What it does |
|---|---|
download |
Fetches the page, redirect, linktarget, pagelinks and page_props dumps, the clickstream, and Wikidata categories |
decompress |
Unpacks the .gz files in parallel |
provision |
Loads the .sql dumps into MariaDB |
build |
Reads MariaDB (read-only) and writes the .wgrf graph |
info |
Prints layout, degree statistics, top pages and spec checks |
explore |
Shows the pages reachable from one page, level by level |
path |
Finds a path between two pages: most followed, shortest, popular or niche |
strategies |
Describes how each path strategy scores a path |
Run any command with --help for its options.
Documentation
The technical documentation is an mdbook in docs/:
mdbook serve docs --open
It covers the pipeline, the local database, how articles and links become a graph, the path search, and development. The WGRF specification describes the file format byte by byte.
Development
dotnet build
dotnet test
dotnet format --verify-no-changes
nix run .#update-deps # after changing NuGet packages
See docs/src/development.md for details.
Limitations
- Only French Wikipedia is tested.
- The graph has no reverse index. The path search scans all links for backward steps instead,
and the weighted strategies (
followed,popular,niche*) search forward only. - The clickstream covers one month and the dumps another: links added since then have no clicks, and the weighted strategies treat them as never clicked.
- Wikidata categories come from a live query, so they can be newer than the dump.
License
GNU Affero General Public License v3.0 only (AGPL-3.0-only).