• C# 97.7%
  • Nix 2.3%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Superkooka 42737b513d
All checks were successful
/ format (push) Successful in 33s
/ test (push) Successful in 38s
/ docs (push) Successful in 4s
/ build-doc (push) Successful in 4s
feat(analyze): clickstream path strategies, view_count and strategies command
- 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
2026-10-01 01:52:31 +02:00
.config init repo 2026-10-01 00:55:37 +02:00
.forgejo/workflows init repo 2026-10-01 00:55:37 +02:00
docs feat(analyze): clickstream path strategies, view_count and strategies command 2026-10-01 01:52:31 +02:00
WikipediaPath.GraphBuilder feat(analyze): clickstream path strategies, view_count and strategies command 2026-10-01 01:52:31 +02:00
WikipediaPath.GraphBuilder.Tests feat(analyze): clickstream path strategies, view_count and strategies command 2026-10-01 01:52:31 +02:00
.gitignore init repo 2026-10-01 00:55:37 +02:00
AGENTS.md init repo 2026-10-01 00:55:37 +02:00
CLAUDE.md init repo 2026-10-01 00:55:37 +02:00
deps.json init repo 2026-10-01 00:55:37 +02:00
flake.lock init repo 2026-10-01 00:55:37 +02:00
flake.nix init repo 2026-10-01 00:55:37 +02:00
global.json init repo 2026-10-01 00:55:37 +02:00
LICENSE init repo 2026-10-01 00:55:37 +02:00
README.md feat(analyze): clickstream path strategies, view_count and strategies command 2026-10-01 01:52:31 +02:00
renovate.json init repo 2026-10-01 00:55:37 +02:00
wikipedia-path.slnx init repo 2026-10-01 00:55:37 +02:00

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).