cricket-kg / README.md
Raghu-varma's picture
Add Cricket KG: 36,619 nodes, 1,392,017 edges from 21,324 Cricsheet matches (CC-BY-4.0)
5557e5f verified
|
Raw
History Blame Contribute Delete
9.32 kB
---
license: cc-by-4.0
language:
- en
tags:
- knowledge-graph
- graph-database
- cypher
- cricket
- sports
- ball-by-ball
pretty_name: Cricket Knowledge Graph (Cricsheet)
size_categories:
- 1M<n<10M
configs:
- config_name: match
data_files: nodes/match.csv
- config_name: player
data_files: nodes/player.csv
- config_name: tournament
data_files: nodes/tournament.csv
- config_name: venue
data_files: nodes/venue.csv
- config_name: team
data_files: nodes/team.csv
- config_name: season
data_files: nodes/season.csv
- config_name: edge_batted_in
data_files: edges/batted_in.csv
- config_name: edge_bowled_in
data_files: edges/bowled_in.csv
- config_name: edge_dismissed
data_files: edges/dismissed.csv
- config_name: edge_fielded_dismissal
data_files: edges/fielded_dismissal.csv
- config_name: edge_competed_in
data_files: edges/competed_in.csv
- config_name: edge_played_for
data_files: edges/played_for.csv
- config_name: edge_won
data_files: edges/won.csv
- config_name: edge_won_toss
data_files: edges/won_toss.csv
- config_name: edge_player_of_match
data_files: edges/player_of_match.csv
- config_name: edge_hosted_at
data_files: edges/hosted_at.csv
- config_name: edge_in_season
data_files: edges/in_season.csv
- config_name: edge_part_of
data_files: edges/part_of.csv
---
# Cricket Knowledge Graph
**36,619 nodes. 1,392,017 edges. 21,324 matches** — Tests, ODIs, T20s, IPL, BBL and more,
men's and women's, from December 2001 to March 2026.
Built with [Samyama Graph](https://github.com/samyama-ai/samyama-graph).
Loader and ETL: [samyama-ai/cricket-kg](https://github.com/samyama-ai/cricket-kg).
## Attribution — required
This dataset is **CC-BY-4.0**, which means attribution is a **condition of use**, not a
courtesy. If you use it, credit the source:
> Source data from **[Cricsheet.org](https://cricsheet.org/)**, licensed
> **[CC-BY-4.0](https://creativecommons.org/licenses/by/4.0/)**.
That requirement travels with the data — anything you redistribute, publish or build on
top of must carry it too.
| | |
|--|--|
| **Data** | **CC-BY-4.0** — attribution required |
| Source | [Cricsheet.org](https://cricsheet.org/) |
| Loader code | Apache-2.0, in the GitHub repo. **This does not govern the data.** |
## What this is
Every match Cricsheet has published, as a property graph rather than a pile of JSON.
Because it is a graph, questions needing several hops are direct: which bowler has dismissed
a given batter most often across formats, which venues a partnership performs best at, how a
player's strike rate moves across seasons and competitions.
**Every node is connected** — there are no isolated records in this graph.
| Format | Matches | | Gender | Matches |
|--------|--------:|--|--------|--------:|
| T20 | 13,069 | | men's | 17,166 |
| ODI | 3,098 | | women's | 4,158 |
| MDM (multi-day) | 2,085 | | | |
| ODM (one-day) | 1,852 | | | |
| Test | 900 | | | |
| IT20 | 320 | | | |
## Files
Nodes carry an `id`; edges reference those ids as `src` and `tgt`. Join on `id`.
### `nodes/`
| File | Rows | Columns |
|------|-----:|---------|
| `match.csv` | 21,324 | `id, file_id, date, gender, match_type, season, win_by_runs, win_by_wickets, winner` |
| `player.csv` | 12,933 | `id, cricsheet_id, name` |
| `tournament.csv` | 1,053 | `id, name` |
| `venue.csv` | 877 | `id, city, name` |
| `team.csv` | 383 | `id, name` |
| `season.csv` | 49 | `id, year` |
### `edges/`
Several edges carry performance data as properties — that is where the detail lives.
| File | Rows | Connects | Properties |
|------|-----:|----------|------------|
| `batted_in.csv` | 401,165 | Player → Match | `runs, balls, fours, sixes, strike_rate, innings_num, super_over` |
| `dismissed.csv` | 308,216 | Player → Player | `kind, over, match_file_id` |
| `bowled_in.csv` | 279,426 | Player → Match | `wickets, overs, maidens, runs_conceded, economy, innings_num` |
| `fielded_dismissal.csv` | 215,869 | Player → Player | `kind, over, match_file_id` |
| `competed_in.csv` | 42,648 | Team → Match | — |
| `played_for.csv` | 24,011 | Player → Team | — |
| `hosted_at.csv` | 21,324 | Match → Venue | — |
| `in_season.csv` | 21,324 | Match → Season | — |
| `won_toss.csv` | 21,324 | Team → Match | `decision` |
| `part_of.csv` | 21,235 | Match → Tournament | `group, match_number` |
| `won.csv` | 19,679 | Team → Match | `by_runs, by_wickets` |
| `player_of_match.csv` | 15,796 | Player → Match | — |
`DISMISSED` is bowler → batter; `FIELDED_DISMISSAL` is fielder → batter. Both carry the
`kind` of dismissal and the `over` it happened in.
### Also included
`cricket.sgsnap` — the same graph as a Samyama snapshot. Loads into the engine in one step,
without running the ETL.
## Usage
### As tables
```python
from datasets import load_dataset
batting = load_dataset("VaidhyaMegha/cricket-kg", "edge_batted_in", revision="v1.0")
print(batting["train"].num_rows) # 401165
```
### As a graph
```bash
docker run --rm -p 8080:8080 -p 6379:6379 public.ecr.aws/f9f6l5u4/samyama-graph:1.1.0
curl -X POST localhost:8080/api/tenants -H 'Content-Type: application/json' \
-d '{"id":"cricket","name":"Cricket KG"}'
curl -X POST localhost:8080/api/tenants/cricket/snapshot/import -F "file=@cricket.sgsnap"
```
```cypher
// Leading run scorers across all formats
MATCH (p:Player)-[b:BATTED_IN]->(:Match)
RETURN p.name AS player, sum(b.runs) AS runs
ORDER BY runs DESC LIMIT 5
// V Kohli 36,545 · KC Sangakkara 30,651 · DA Warner 28,317 · RG Sharma 26,748
// Which bowler has dismissed a given batter most often — a question about the
// relationship itself, which is awkward in SQL and direct in a graph
MATCH (bowler:Player)-[d:DISMISSED]->(batter:Player)
RETURN bowler.name, batter.name, count(d) AS times
ORDER BY times DESC LIMIT 10
```
## Provenance
**1. Original source — [Cricsheet.org](https://cricsheet.org/)**, ball-by-ball match data
as JSON, **CC-BY-4.0**. 21,325 files at the time of extraction.
**2. ETL — [samyama-ai/cricket-kg](https://github.com/samyama-ai/cricket-kg)**, which maps
those files to a property graph.
**3. This dataset** — exported from a Samyama snapshot taken **2026-03-14**
(`sgsnap` format v1, engine **v0.6.0**), then flattened to CSV. Totals were asserted against
the snapshot header — **36,619** nodes and **1,392,017** edges — and re-verified after upload.
## Versioning
| Version | Date | Contents |
|---------|------|----------|
| **`v1.0`** | 2026-08-17 | Initial release — 36,619 nodes, 1,392,017 edges from the 2026-03-14 snapshot |
**Pin the tag, not `main`.** `main` moves; a tag does not.
```python
load_dataset("VaidhyaMegha/cricket-kg", "player", revision="v1.0")
```
Data changes get a new tag (`v1.1`, `v2.0`); corrections to this card alone land on `main`.
## Limitations
- **Not literally ball-by-ball.** It is *built from* Cricsheet's ball-by-ball files, but the
graph stores **per-innings aggregates** (`BATTED_IN`, `BOWLED_IN`) plus individual
dismissals with their over. Delivery-level rows are not preserved. For per-ball analysis,
go to the Cricsheet source files.
- **Coverage starts 2001-12-19** and ends **2026-03-11** — Cricsheet's own range, not the
whole history of the sport. Older Tests are absent.
- **Player identity is per-Cricsheet.** `cricsheet_id` is the key; players are not
reconciled against any external registry, and name spellings follow Cricsheet's.
- **Teams are strings** — national sides and franchises share the `Team` label with no
distinction between them.
- No ball-by-ball commentary, no partnerships as first-class objects, no fielding positions.
Verified: totals match the snapshot header exactly, **every node has at least one edge**
(0 orphans of 36,619), and aggregates reproduce known records — V Kohli leading run-scorer,
JM Anderson leading wicket-taker at 1,140.
## Citation
CC-BY-4.0 **requires** attribution. Cite both the source and this build.
**Original source:**
```
Cricsheet. Ball-by-ball cricket data. https://cricsheet.org/
Licensed CC-BY-4.0. https://creativecommons.org/licenses/by/4.0/
```
**This graph build:**
```
Cricket Knowledge Graph, v1.0 (36,619 nodes, 1,392,017 edges).
Built with Samyama Graph. https://huggingface.co/datasets/VaidhyaMegha/cricket-kg
ETL: https://github.com/samyama-ai/cricket-kg
Source data: Cricsheet.org, CC-BY-4.0, https://cricsheet.org/
```
```bibtex
@misc{cricket_kg_samyama,
title = {Cricket Knowledge Graph},
howpublished = {\url{https://huggingface.co/datasets/VaidhyaMegha/cricket-kg}},
version = {v1.0},
note = {Derived from Cricsheet.org ball-by-ball data, CC-BY-4.0,
\url{https://cricsheet.org/}.
ETL: \url{https://github.com/samyama-ai/cricket-kg}},
year = {2026}
}
```
### The three pieces
| Piece | Where |
|-------|-------|
| **Code** — ETL, schema, loaders | [github.com/samyama-ai/cricket-kg](https://github.com/samyama-ai/cricket-kg) |
| **Data** — this dataset, and the raw source it derives from | here, and [cricsheet.org](https://cricsheet.org/) |
| **Graph** — importable snapshot | `cricket.sgsnap` in this repository |