logo Netzschleuder network catalog, repository, and centrifuge

History of pokemon

The changes to the source code of this entry in the repository, newest first, each with the differences it made to the entry's files. They are also listed on GitLab.

[entries] Remove superfluous details of the upstream distribution from the descriptions by Tiago de Paula Peixoto dc07aa0
The descriptions mentioned incidental details of how the upstream data
are made available: the file formats (CSV, JSON, XML, GEXF, SBML, HIF,
Pajek, UCINET, ...), file names, where the files were published or
obtained from (Zenodo, figshare, Kaggle, the Pajek datasets page, the
Internet Archive), and that some networks are only available in the gt
format. These are left out; caveats about the data themselves are kept,
referring to "the data" instead of "the file". The description of
sp_baboons now lists its properties instead of the upstream columns,
and says that events without a recipient are left out.
diff --git a/entries/pokemon/__init__.py b/entries/pokemon/__init__.py
index fe4187b..0e35d6c 100644
--- a/entries/pokemon/__init__.py
+++ b/entries/pokemon/__init__.py
@@ -19,7 +19,7 @@
 from .. import *
 
 title = "Pokémon moves and encounter locations (1996-2026)"
-description = """Bipartite networks of Pokémon and the moves they can learn, and of Pokémon and the in-game location areas where they can be encountered in the wild, across the main-series Pokémon video games (from Red/Blue, 1996, to the most recent games covered). The data come from PokéAPI, a community-maintained database of the games' contents, compiled by its contributors from the games themselves; this version corresponds to the CSV tables of the PokéAPI repository at commit 2bf639e. Each Pokémon form with its own entry in the database (e.g. regional variants and mega evolutions) is a separate node. Only Pokémon, moves and location areas that take part in at least one relation are included.
+description = """Bipartite networks of Pokémon and the moves they can learn, and of Pokémon and the in-game location areas where they can be encountered in the wild, across the main-series Pokémon video games (from Red/Blue, 1996, to the most recent games covered). The data come from PokéAPI, a community-maintained database of the games' contents, compiled by its contributors from the games themselves; this version corresponds to commit 2bf639e of the PokéAPI repository. Each Pokémon form with its own entry in the database (e.g. regional variants and mega evolutions) is a separate node. Only Pokémon, moves and location areas that take part in at least one relation are included.
 
 - `moves`: each edge connects a Pokémon to a move it can learn, in a given version group (set of games released together) and with a given learn method. The same Pokémon and move are connected by several parallel edges if the move is learnable in several version groups, with several methods, or at several levels.
 - `locations`: each edge connects a Pokémon to a location area where it appears in the wild, for a given game version and encounter slot. Parallel edges correspond to different versions, encounter methods or slots.
[entries] Add the date when each entry was added, and remove icon_hash by Tiago de Paula Peixoto beff7c9
The dates are those of the commits that first added the entries' files
(2020-08-11 for the entries of the initial commit); renamed entries keep
the date of their first name.

Changed: none
diff --git a/entries/pokemon/__init__.py b/entries/pokemon/__init__.py
index 3324a9f..fe4187b 100644
--- a/entries/pokemon/__init__.py
+++ b/entries/pokemon/__init__.py
@@ -57,7 +57,7 @@ The networks have the following properties:
 tags = ['Fictional', 'Unweighted', 'Multigraph', 'Metadata']
 url = 'https://pokeapi.co/'
 citation = [('P. Hallett and PokéAPI contributors, "PokéAPI: The Pokémon API." (2026)', 'https://github.com/PokeAPI/pokeapi')]
-icon_hash = None
+date_added = '2026-10-25'
 upstream_license = ("BSD 3-Clause", "https://github.com/PokeAPI/pokeapi/blob/2bf639e5572812a67d2b94903fdcb9d095f5aeb2/LICENSE.md")
 upstream_prefix = 'https://raw.githubusercontent.com/PokeAPI/pokeapi/2bf639e5572812a67d2b94903fdcb9d095f5aeb2/data/v2/csv'
 _common = ('pokemon.csv', 'pokemon_species_names.csv', 'pokemon_types.csv',
[entries] Prefix the properties in the descriptions with (Node), (Edge) or (Graph) by Tiago de Paula Peixoto bc3dbbd
The lists of properties at the end of the descriptions marked edge
properties with "Edge" but left node properties unmarked, or grouped
them in "Nodes: `a`, ...; `b`, ..." items, so the kind of a property
was often unclear. Every item now starts with (Node), (Edge) or (Graph),
followed by the property names, a colon and the explanation, one item
per property or group of properties; qualifications (kinds of nodes,
networks) follow the names in parentheses. Properties that were only
named got a short explanation, and a few items that named the wrong
kind of property were corrected.
diff --git a/entries/pokemon/__init__.py b/entries/pokemon/__init__.py
index f2459a6..3324a9f 100644
--- a/entries/pokemon/__init__.py
+++ b/entries/pokemon/__init__.py
@@ -26,9 +26,34 @@ description = """Bipartite networks of Pokémon and the moves they can learn, an
 
 The networks have the following properties:
 
-- Pokémon nodes: `name`, the PokéAPI identifier of the Pokémon (form); `species`, the English name of its species; `pokemon_id`, the PokéAPI id (ids larger than 10000 are alternate forms); `types`, its type(s), separated by "/"; `height`, in decimetres; `weight`, in hectograms; `base_experience`, the base experience gained by defeating it (-1 if unknown); `default_form`, whether it is the default form of its species.
-- `moves`: `is_move`, whether the node is a move (otherwise a Pokémon). Move nodes: `name`, the PokéAPI identifier of the move; `move_id`, its PokéAPI id (ids larger than 10000 are "shadow" moves); `move_type`, its type; `damage_class` (status, physical or special); `generation`, the generation in which it was introduced (1-9); `power`, `pp` (power points) and `accuracy` (in percent), with -1 when not applicable; `priority`. Edges: `version_group`, the identifier of the version group (e.g. "red-blue"); `method`, the learn method (e.g. "level-up", "egg", "tutor", "machine"); `level`, the level at which the move is learned (0 if not applicable); `mastery`, the level at which the move can be mastered (in Pokémon Legends: Arceus only, -1 otherwise).
-- `locations`: `is_area`, whether the node is a location area (otherwise a Pokémon). Area nodes: `name`, the PokéAPI identifier of the area, formed from the location identifier and the area identifier, or with the suffix "-area" when the location has a single unnamed area; `location`, the English name of the location; `region`, the region of the location (e.g. "kanto"; empty if unknown). Edges: `version`, the game version (e.g. "red"); `method`, the encounter method (e.g. "walk", "surf", "old-rod"); `rarity`, the chance of the encounter slot, in percent; `min_level` and `max_level`, the range of levels of the encountered Pokémon."""
+- (Node) `name` (Pokémon): the PokéAPI identifier of the Pokémon (form).
+- (Node) `species` (Pokémon): the English name of its species.
+- (Node) `pokemon_id` (Pokémon): the PokéAPI id (ids larger than 10000 are alternate forms).
+- (Node) `types` (Pokémon): its type(s), separated by "/".
+- (Node) `height` (Pokémon): the height, in decimeters.
+- (Node) `weight` (Pokémon): the weight, in hectograms.
+- (Node) `base_experience` (Pokémon): the base experience gained by defeating it (-1 if unknown).
+- (Node) `default_form` (Pokémon): whether it is the default form of its species.
+- (Node) `is_move` (`moves`): whether the node is a move (otherwise a Pokémon).
+- (Node) `name` (moves): the PokéAPI identifier of the move.
+- (Node) `move_id` (moves): its PokéAPI id (ids larger than 10000 are "shadow" moves).
+- (Node) `move_type` (moves): its type.
+- (Node) `damage_class` (moves): status, physical or special.
+- (Node) `generation` (moves): the generation in which it was introduced (1-9).
+- (Node) `power`, `pp`, `accuracy` (moves): the power, the power points and the accuracy (in percent), with -1 when not applicable.
+- (Node) `priority` (moves): the priority of the move.
+- (Edge) `version_group` (`moves`): the identifier of the version group (e.g. "red-blue").
+- (Edge) `method` (`moves`): the learn method (e.g. "level-up", "egg", "tutor", "machine").
+- (Edge) `level` (`moves`): the level at which the move is learned (0 if not applicable).
+- (Edge) `mastery` (`moves`): the level at which the move can be mastered (in Pokémon Legends: Arceus only, -1 otherwise).
+- (Node) `is_area` (`locations`): whether the node is a location area (otherwise a Pokémon).
+- (Node) `name` (areas): the PokéAPI identifier of the area, formed from the location identifier and the area identifier, or with the suffix "-area" when the location has a single unnamed area.
+- (Node) `location` (areas): the English name of the location.
+- (Node) `region` (areas): the region of the location (e.g. "kanto"; empty if unknown).
+- (Edge) `version` (`locations`): the game version (e.g. "red").
+- (Edge) `method` (`locations`): the encounter method (e.g. "walk", "surf", "old-rod").
+- (Edge) `rarity` (`locations`): the chance of the encounter slot, in percent.
+- (Edge) `min_level`, `max_level` (`locations`): the range of levels of the encountered Pokémon."""
 tags = ['Fictional', 'Unweighted', 'Multigraph', 'Metadata']
 url = 'https://pokeapi.co/'
 citation = [('P. Hallett and PokéAPI contributors, "PokéAPI: The Pokémon API." (2026)', 'https://github.com/PokeAPI/pokeapi')]
[entries] Remove unneeded code from the entries by Tiago de Paula Peixoto 2c69f19
Unneeded "global files" statements, unused imports and variables,
f-strings without placeholders, duplicate keys in foodweb_little_rock
(keeping the order and the values used), and the second definition of
get_lines() in twitter_higgs. Nothing changes in the networks or
descriptions.

Changed: none
diff --git a/entries/pokemon/__init__.py b/entries/pokemon/__init__.py
index 5c730d4..f2459a6 100644
--- a/entries/pokemon/__init__.py
+++ b/entries/pokemon/__init__.py
@@ -60,7 +60,6 @@ def _int(x, default=-1):
 @coerce_props()
 @annotate()
 def parse(alts=None):
-    global files
     name = __name__.split(".")[-1]
     for fnames, alt, fmt in files:
         if alts is not None and alt not in alts:
[entries] New entry: pokemon by Tiago de Paula Peixoto fa1f77c
diff --git a/entries/pokemon/__init__.py b/entries/pokemon/__init__.py
new file mode 100644
index 0000000..5c730d4
--- /dev/null
+++ b/entries/pokemon/__init__.py
@@ -0,0 +1,204 @@
+#! /usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2020-2026 Tiago de Paula Peixoto <tiago@skewed.de>
+#
+# This program is free software: you can redistribute it and/or modify it under
+# the terms of the GNU Affero General Public License as published by the Free
+# Software Foundation, either version 3 of the License, or (at your option) any
+# later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Affero General Public License along
+# with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+from .. import *
+
+title = "Pokémon moves and encounter locations (1996-2026)"
+description = """Bipartite networks of Pokémon and the moves they can learn, and of Pokémon and the in-game location areas where they can be encountered in the wild, across the main-series Pokémon video games (from Red/Blue, 1996, to the most recent games covered). The data come from PokéAPI, a community-maintained database of the games' contents, compiled by its contributors from the games themselves; this version corresponds to the CSV tables of the PokéAPI repository at commit 2bf639e. Each Pokémon form with its own entry in the database (e.g. regional variants and mega evolutions) is a separate node. Only Pokémon, moves and location areas that take part in at least one relation are included.
+
+- `moves`: each edge connects a Pokémon to a move it can learn, in a given version group (set of games released together) and with a given learn method. The same Pokémon and move are connected by several parallel edges if the move is learnable in several version groups, with several methods, or at several levels.
+- `locations`: each edge connects a Pokémon to a location area where it appears in the wild, for a given game version and encounter slot. Parallel edges correspond to different versions, encounter methods or slots.
+
+The networks have the following properties:
+
+- Pokémon nodes: `name`, the PokéAPI identifier of the Pokémon (form); `species`, the English name of its species; `pokemon_id`, the PokéAPI id (ids larger than 10000 are alternate forms); `types`, its type(s), separated by "/"; `height`, in decimetres; `weight`, in hectograms; `base_experience`, the base experience gained by defeating it (-1 if unknown); `default_form`, whether it is the default form of its species.
+- `moves`: `is_move`, whether the node is a move (otherwise a Pokémon). Move nodes: `name`, the PokéAPI identifier of the move; `move_id`, its PokéAPI id (ids larger than 10000 are "shadow" moves); `move_type`, its type; `damage_class` (status, physical or special); `generation`, the generation in which it was introduced (1-9); `power`, `pp` (power points) and `accuracy` (in percent), with -1 when not applicable; `priority`. Edges: `version_group`, the identifier of the version group (e.g. "red-blue"); `method`, the learn method (e.g. "level-up", "egg", "tutor", "machine"); `level`, the level at which the move is learned (0 if not applicable); `mastery`, the level at which the move can be mastered (in Pokémon Legends: Arceus only, -1 otherwise).
+- `locations`: `is_area`, whether the node is a location area (otherwise a Pokémon). Area nodes: `name`, the PokéAPI identifier of the area, formed from the location identifier and the area identifier, or with the suffix "-area" when the location has a single unnamed area; `location`, the English name of the location; `region`, the region of the location (e.g. "kanto"; empty if unknown). Edges: `version`, the game version (e.g. "red"); `method`, the encounter method (e.g. "walk", "surf", "old-rod"); `rarity`, the chance of the encounter slot, in percent; `min_level` and `max_level`, the range of levels of the encountered Pokémon."""
+tags = ['Fictional', 'Unweighted', 'Multigraph', 'Metadata']
+url = 'https://pokeapi.co/'
+citation = [('P. Hallett and PokéAPI contributors, "PokéAPI: The Pokémon API." (2026)', 'https://github.com/PokeAPI/pokeapi')]
+icon_hash = None
+upstream_license = ("BSD 3-Clause", "https://github.com/PokeAPI/pokeapi/blob/2bf639e5572812a67d2b94903fdcb9d095f5aeb2/LICENSE.md")
+upstream_prefix = 'https://raw.githubusercontent.com/PokeAPI/pokeapi/2bf639e5572812a67d2b94903fdcb9d095f5aeb2/data/v2/csv'
+_common = ('pokemon.csv', 'pokemon_species_names.csv', 'pokemon_types.csv',
+           'types.csv')
+files = [(_common + ('pokemon_moves.csv', 'moves.csv', 'move_damage_classes.csv',
+                     'version_groups.csv', 'pokemon_move_methods.csv'),
+          'moves', None),
+         (_common + ('encounters.csv', 'location_areas.csv', 'locations.csv',
+                     'location_names.csv', 'regions.csv', 'versions.csv',
+                     'encounter_slots.csv', 'encounter_methods.csv'),
+          'locations', None)]
+
+def fetch_upstream(force=False):
+    return fetch_upstream_files(__name__.split(".")[-1], upstream_prefix, files,
+                                force)
+
+def _rows(f):
+    rows = csv.DictReader(f)
+    return list(rows)
+
+def _int(x, default=-1):
+    return int(x) if x != "" else default
+
+@cache_network()
+@coerce_props()
+@annotate()
+def parse(alts=None):
+    global files
+    name = __name__.split(".")[-1]
+    for fnames, alt, fmt in files:
+        if alts is not None and alt not in alts:
+            continue
+        if isinstance(fnames, str):
+            fnames = [fnames]
+        with ExitStack() as stack:
+            fs = {fn: stack.enter_context(open_upstream_file(name, fn, "r"))
+                  for fn in fnames}
+
+            pokemon = {int(r["id"]): r for r in _rows(fs["pokemon.csv"])}
+            species = {int(r["pokemon_species_id"]): r["name"]
+                       for r in _rows(fs["pokemon_species_names.csv"])
+                       if r["local_language_id"] == "9"}
+            types = {r["id"]: r["identifier"] for r in _rows(fs["types.csv"])}
+            ptypes = {}
+            for r in sorted(_rows(fs["pokemon_types.csv"]),
+                            key=lambda r: int(r["slot"])):
+                ptypes.setdefault(int(r["pokemon_id"]), []).append(types[r["type_id"]])
+
+            if alt == "moves":
+                rel = _rows(fs["pokemon_moves.csv"])
+                gkey = "move_id"
+            else:
+                rel = _rows(fs["encounters.csv"])
+                gkey = "location_area_id"
+
+            # Pokémon and groups (moves or areas) that occur in the relation,
+            # in increasing order of id
+            pids = sorted(set(int(r["pokemon_id"]) for r in rel))
+            gids = sorted(set(int(r[gkey]) for r in rel))
+            pidx = {p: i for i, p in enumerate(pids)}
+            NP = len(pids)
+            gidx = {x: NP + i for i, x in enumerate(gids)}
+
+            g = Graph(directed=False)
+            g.add_vertex(NP + len(gids))
+            g.vp.name = g.new_vp("string")
+            g.vp.species = g.new_vp("string")
+            g.vp.pokemon_id = g.new_vp("int")
+            g.vp.types = g.new_vp("string")
+            g.vp.height = g.new_vp("int")
+            g.vp.weight = g.new_vp("int")
+            g.vp.base_experience = g.new_vp("int")
+            g.vp.default_form = g.new_vp("bool")
+            for p, v in pidx.items():
+                r = pokemon[p]
+                g.vp.name[v] = r["identifier"]
+                g.vp.species[v] = species.get(int(r["species_id"]), "")
+                g.vp.pokemon_id[v] = p
+                g.vp.types[v] = "/".join(ptypes.get(p, []))
+                g.vp.height[v] = _int(r["height"])
+                g.vp.weight[v] = _int(r["weight"])
+                g.vp.base_experience[v] = _int(r["base_experience"])
+                g.vp.default_form[v] = r["is_default"] == "1"
+
+            if alt == "moves":
+                moves = {int(r["id"]): r for r in _rows(fs["moves.csv"])}
+                dclass = {r["id"]: r["identifier"]
+                          for r in _rows(fs["move_damage_classes.csv"])}
+                vgroups = {r["id"]: r["identifier"]
+                           for r in _rows(fs["version_groups.csv"])}
+                methods = {r["id"]: r["identifier"]
+                           for r in _rows(fs["pokemon_move_methods.csv"])}
+                g.vp.is_move = g.new_vp("bool")
+                g.vp.move_id = g.new_vp("int")
+                g.vp.move_type = g.new_vp("string")
+                g.vp.damage_class = g.new_vp("string")
+                g.vp.generation = g.new_vp("int")
+                g.vp.power = g.new_vp("int")
+                g.vp.pp = g.new_vp("int")
+                g.vp.accuracy = g.new_vp("int")
+                g.vp.priority = g.new_vp("int")
+                for m, v in gidx.items():
+                    r = moves[m]
+                    g.vp.is_move[v] = True
+                    g.vp.name[v] = r["identifier"]
+                    g.vp.move_id[v] = m
+                    g.vp.move_type[v] = types.get(r["type_id"], "")
+                    g.vp.damage_class[v] = dclass.get(r["damage_class_id"], "")
+                    g.vp.generation[v] = _int(r["generation_id"])
+                    g.vp.power[v] = _int(r["power"])
+                    g.vp.pp[v] = _int(r["pp"])
+                    g.vp.accuracy[v] = _int(r["accuracy"])
+                    g.vp.priority[v] = _int(r["priority"], 0)
+
+                g.ep.version_group = g.new_ep("string")
+                g.ep.method = g.new_ep("string")
+                g.ep.level = g.new_ep("int")
+                g.ep.mastery = g.new_ep("int")
+                g.add_edge_list([(pidx[int(r["pokemon_id"])], gidx[int(r["move_id"])])
+                                 for r in rel])
+                g.ep.level.a = [_int(r["level"], 0) for r in rel]
+                g.ep.mastery.a = [_int(r["mastery"]) for r in rel]
+                for e in g.edges():
+                    # edge indices follow the order of the rows
+                    r = rel[g.edge_index[e]]
+                    g.ep.version_group[e] = vgroups[r["version_group_id"]]
+                    g.ep.method[e] = methods[r["pokemon_move_method_id"]]
+            else:
+                areas = {int(r["id"]): r for r in _rows(fs["location_areas.csv"])}
+                locs = {r["id"]: r for r in _rows(fs["locations.csv"])}
+                lnames = {r["location_id"]: r["name"]
+                          for r in _rows(fs["location_names.csv"])
+                          if r["local_language_id"] == "9"}
+                regions = {r["id"]: r["identifier"] for r in _rows(fs["regions.csv"])}
+                versions = {r["id"]: r["identifier"] for r in _rows(fs["versions.csv"])}
+                emethods = {r["id"]: r["identifier"]
+                            for r in _rows(fs["encounter_methods.csv"])}
+                slots = {r["id"]: r for r in _rows(fs["encounter_slots.csv"])}
+                g.vp.is_area = g.new_vp("bool")
+                g.vp.location = g.new_vp("string")
+                g.vp.region = g.new_vp("string")
+                for a, v in gidx.items():
+                    r = areas[a]
+                    l = locs[r["location_id"]]
+                    g.vp.is_area[v] = True
+                    suffix = r["identifier"] if r["identifier"] != "" else "area"
+                    g.vp.name[v] = f'{l["identifier"]}-{suffix}'
+                    g.vp.location[v] = lnames.get(r["location_id"], "")
+                    g.vp.region[v] = regions.get(l["region_id"], "")
+
+                g.ep.version = g.new_ep("string")
+                g.ep.method = g.new_ep("string")
+                g.ep.rarity = g.new_ep("int")
+                g.ep.min_level = g.new_ep("int")
+                g.ep.max_level = g.new_ep("int")
+                g.add_edge_list([(pidx[int(r["pokemon_id"])],
+                                  gidx[int(r["location_area_id"])])
+                                 for r in rel])
+                g.ep.min_level.a = [_int(r["min_level"]) for r in rel]
+                g.ep.max_level.a = [_int(r["max_level"]) for r in rel]
+                g.ep.rarity.a = [_int(slots[r["encounter_slot_id"]]["rarity"])
+                                 for r in rel]
+                for e in g.edges():
+                    # edge indices follow the order of the rows
+                    r = rel[g.edge_index[e]]
+                    g.ep.version[e] = versions[r["version_id"]]
+                    s = slots[r["encounter_slot_id"]]
+                    g.ep.method[e] = emethods[s["encounter_method_id"]]
+        yield alt, g