Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Introduction

Wikipedia Path turns French Wikipedia into a graph of links, then finds the shortest chain of clicks from one article to another.

Every article is a node. Every link from one article to another is an edge. With this graph, you can answer questions like “how many clicks from Tour Eiffel to Pikachu?”:

$ WikipediaPath.GraphBuilder path "Tour Eiffel" "Pikachu"
Searched 99,483 pages in 30 ms.
2 clicks from 'Tour Eiffel' to 'Pikachu':
  0. Tour Eiffel
  1. Jeu vidéo
  2. Pikachu

What is in the repository

PathContent
WikipediaPath.GraphBuilder/Command-line tool: downloads the dumps, builds the graph, reads it
WikipediaPath.GraphBuilder.Tests/xUnit tests
docs/This book, and the WGRF file format specification
flake.nixNix dev shell, package and local MariaDB scripts

How it works, in short

  1. download fetches the SQL dumps of French Wikipedia and a list of date and country pages from Wikidata.
  2. decompress unpacks the .gz files.
  3. provision loads the SQL dumps into a local MariaDB database.
  4. build reads the database and writes one binary file, graph.wgrf.
  5. info, explore and path read that file.

The graph file uses the WGRF format. It is a compact, memory-mapped layout built for fast breadth-first search. The specification describes it byte by byte.

Size of the data

Numbers from the frwiki dump of 2026-09-01:

ItemSize
Articles (nodes)2,777,420
Links (edges)235,141,317
Searchable names (titles and redirects)4,619,033
Compressed dumps (.gz)about 2.7 GB
Decompressed SQLabout 12.5 GB
MariaDB data directoryabout 64 GB
graph.wgrfabout 1.1 GB

Limitations

  • Only French Wikipedia (frwiki) is tested. The --wiki option exists, but the date and country examples in the spec are French.
  • The clickstream covers one month and the dumps another, so some measured links are missing from the graph and their clicks are dropped.
  • Wikidata categories come from a live query, so they can be newer than the dump.

License

Wikipedia Path is licensed under the GNU Affero General Public License v3.0 only (AGPL-3.0-only). See the LICENSE file at the root of the repository.