History of game_thrones
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] game_thrones: add the book and TV series networks of A Song of Ice and Fire 45d7909
The entry had only the network of the third book of Beveridge and Shan (2016). The later networks of the authors' repositories are added: one per book of "A Song of Ice and Fire", books 4 and 5 together, all the books, and one per season of the TV series "Game of Thrones". The original network, so far unnamed, is now named `stormofswords`: an unnamed network alongside named ones is not supported by the site and the drawings, which use the analyses of the largest network for it. Changed: upstream game_thrones
diff --git a/entries/game_thrones/__init__.py b/entries/game_thrones/__init__.py
index 804f517..9ce65e6 100644
--- a/entries/game_thrones/__init__.py
+++ b/entries/game_thrones/__init__.py
@@ -18,26 +18,53 @@
from .. import *
-title = "Game of Thrones coappearances"
-description = r"""Network of co-occurrences of characters in "A Storm of Swords", the third book of George R. R. Martin's fantasy series "A Song of Ice and Fire" (the basis of the TV series "Game of Thrones"), compiled by A. Beveridge and J. Shan. Nodes are characters, and two characters are connected by an undirected edge whenever their names (or nicknames) appear within 15 words of each other in the text. Only pairs that co-occur at least 4 times are included in the data.
+title = "Game of Thrones and A Song of Ice and Fire character interactions"
+description = r"""Networks of interactions between the characters of George R. R. Martin's fantasy series "A Song of Ice and Fire" and of its TV adaptation, HBO's "Game of Thrones", compiled by A. Beveridge and collaborators. Nodes are characters, and edges are undirected and weighted by the number of interactions between the two characters.
-The network has the following properties:
+In the networks of the books, two characters are connected whenever their names (or nicknames) appear within 15 words of each other in the text. The first network, `stormofswords`, is the original network of the third book, "A Storm of Swords", of Beveridge and Shan (2016), with 107 characters and only the pairs that co-occur at least 4 times. The other book networks are the later versions in the author's GitHub repository `mathbeveridge/asoiaf`, which contain only the pairs that co-occur at least 3 times: one network per book, `book1` ("A Game of Thrones"), `book2` ("A Clash of Kings"), `book3` ("A Storm of Swords"), `book4` ("A Feast for Crows") and `book5` ("A Dance with Dragons"), a network `book45` of books 4 and 5 together (which tell simultaneous events), and a network `all_books` of all five books.
-- `name`: the character's name.
-- `weight` (edges): the number of co-occurrences of the two characters."""
-tags = ['Social', 'Fictional', 'Weighted']
-url = 'https://web.archive.org/web/20220308184757/https://www.macalester.edu/~abeverid/data/stormofswords.csv'
-citation = [('A. Beveridge and J. Shan, "Network of Thrones." Math Horizons 23(4), 18-22 (2016)', 'https://doi.org/10.4169/mathhorizons.23.4.18')]
+In the networks of the TV series (from the repository `mathbeveridge/gameofthrones`), one per season, `season1`, ..., `season8`, the interactions were extracted from fan-made scripts of the episodes (from genius.com): two characters A and B interact whenever A speaks directly after B, A speaks about B, a third character speaks about both A and B, A and B are mentioned in the same stage direction, or A and B appear in a scene together. Only the pairs with at least 2 interactions in a season are included in the data. The data of seasons 5 and 6 contain one pair twice each (Mace and Meryn Trant in season 5, Bowen Marsh and Othell Yarwyck in season 6), with different weights; both are kept, as parallel edges.
+
+The networks have the following properties:
+
+- `name`: the character's name (in the networks of the TV series, often only the first name).
+- `id`: the identifier of the character in the data (not present in `stormofswords`).
+- `weight` (edges): the number of interactions of the two characters."""
+tags = ['Social', 'Fictional', 'Weighted', 'Multigraph']
+url = ['https://web.archive.org/web/20220308184757/https://www.macalester.edu/~abeverid/data/stormofswords.csv',
+ 'https://github.com/mathbeveridge/asoiaf',
+ 'https://github.com/mathbeveridge/gameofthrones']
+citation = [('A. Beveridge and J. Shan, "Network of Thrones." Math Horizons 23(4), 18-22 (2016)', 'https://doi.org/10.4169/mathhorizons.23.4.18'),
+ ('A. Beveridge and M. Chemers, "The Game of Game of Thrones: Networked Concordances and Fractal Dramaturgy." In: P. Brembilla and I. A. De Pascalis (eds.), Reading Contemporary Serial Television Universes: A Narrative Ecosystem Framework, Routledge, 201-225 (2018)', 'https://doi.org/10.4324/9781315114668-13')]
+upstream_license = ("Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)",
+ "https://creativecommons.org/licenses/by-nc-sa/4.0/")
icon_hash = '57029012a6d70217090ce009'
-# The file is no longer on the author's site (the networks in his GitHub
-# repositories are different versions); it is fetched from the Internet
-# Archive
+# The file of the original network is no longer on the author's site; it is
+# fetched from the Internet Archive
upstream_prefix = 'https://web.archive.org/web/20220308184757id_/https://www.macalester.edu/~abeverid/data'
-files = [('stormofswords.csv', None, ('csv', {'props': ['weight']}))]
+# The later versions, from the author's GitHub repositories (pinned commits)
+asoiaf_prefix = 'https://raw.githubusercontent.com/mathbeveridge/asoiaf/4003f7928ee65da712e9db44b3df860375d958e5/data'
+got_prefix = 'https://raw.githubusercontent.com/mathbeveridge/gameofthrones/068e0af18cc6b71e064472e34da1aa5c27c9de8d/data'
+orig_files = [('stormofswords.csv', 'stormofswords', ('csv', {'props': ['weight']}))]
+asoiaf_files = [((f'asoiaf-{b}-nodes.csv', f'asoiaf-{b}-edges.csv'),
+ b if b != "all" else "all_books", None)
+ for b in ["book1", "book2", "book3", "book4", "book5", "book45", "all"]]
+got_files = [((f'got-s{s}-nodes.csv', f'got-s{s}-edges.csv'), f"season{s}", None)
+ for s in range(1, 9)]
+files = orig_files + asoiaf_files + got_files
def fetch_upstream(force=False):
- return fetch_upstream_files(__name__.split(".")[-1], upstream_prefix, files,
- force)
+ name = __name__.split(".")[-1]
+ fetch_upstream_files(name, upstream_prefix, orig_files, force)
+ fetch_upstream_files(name, asoiaf_prefix, asoiaf_files, force)
+ return fetch_upstream_files(name, got_prefix, got_files, force)
+
+def read_csv(name, fname):
+ # The files of the books have old Mac line endings ("\r")
+ with open_upstream_file(name, fname, "rb") as f:
+ text = f.read().decode("utf-8")
+ text = text.replace("\r\n", "\n").replace("\r", "\n")
+ return list(csv.DictReader(io.StringIO(text)))
@cache_network()
@coerce_props()
@@ -48,9 +75,28 @@ def parse(alts=None):
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 = [stack.enter_context(open_upstream_file(name, fn, "rb")) for fn in fnames]
- g = parse_graph(fs, fmt, directed=False)
+ if fmt is not None:
+ with open_upstream_file(name, fnames, "rb") as f:
+ g = parse_graph([f], fmt, directed=False)
+ yield alt, g
+ continue
+ nodes = read_csv(name, fnames[0])
+ edges = read_csv(name, fnames[1])
+ g = Graph(directed=False)
+ g.vp.name = g.new_vp("string")
+ g.vp.id = g.new_vp("string")
+ idx = {}
+ def get_v(i, label=None):
+ if i not in idx:
+ v = g.add_vertex()
+ idx[i] = int(v)
+ g.vp.id[v] = i
+ g.vp.name[v] = label if label is not None else i
+ return idx[i]
+ for r in nodes:
+ get_v(r["Id"], r["Label"])
+ g.ep.weight = g.new_ep("int")
+ for r in edges:
+ e = g.add_edge(get_v(r["Source"]), get_v(r["Target"]))
+ g.ep.weight[e] = int(r.get("weight", r.get("Weight")))
yield alt, g
[entries] Move unavailable upstream sources to verified alternatives 2137af6
The upstream sources of these entries are gone, moved, or refuse automated downloads; each now downloads the same data (byte-identical to the cached files, or for board_directors, identical apart from line endings) from: - add_health: the Wayback Machine (Moreno's site, as its sibling entries) - board_directors: T. Opsahl's site (opsahl.co.uk) - copenhagen, cow_signed_relations, fullerene_structures, german_power_grid: figshare's API (its downloader refuses the server) - drosophila_flybi: the same address, without a doubled slash - dutch_criticism: V. Batagelj's repository of Pajek data on GitHub - fly_larva: the copy of the supplementary files in Europe PMC - foursquare: the authors' Google Drive file - game_thrones, microsoft_concept, un_migrations: pinned Wayback Machine snapshots - internet_top_pop: the Topology Zoo repository on GitHub - scotus_majority: Harvard Dataverse and Wayback Machine snapshots
diff --git a/entries/game_thrones/__init__.py b/entries/game_thrones/__init__.py
index 9e80d48..804f517 100644
--- a/entries/game_thrones/__init__.py
+++ b/entries/game_thrones/__init__.py
@@ -26,10 +26,13 @@ The network has the following properties:
- `name`: the character's name.
- `weight` (edges): the number of co-occurrences of the two characters."""
tags = ['Social', 'Fictional', 'Weighted']
-url = 'http://www.macalester.edu/~abeverid/data/stormofswords.csv'
+url = 'https://web.archive.org/web/20220308184757/https://www.macalester.edu/~abeverid/data/stormofswords.csv'
citation = [('A. Beveridge and J. Shan, "Network of Thrones." Math Horizons 23(4), 18-22 (2016)', 'https://doi.org/10.4169/mathhorizons.23.4.18')]
icon_hash = '57029012a6d70217090ce009'
-upstream_prefix = 'http://www.macalester.edu/~abeverid/data/'
+# The file is no longer on the author's site (the networks in his GitHub
+# repositories are different versions); it is fetched from the Internet
+# Archive
+upstream_prefix = 'https://web.archive.org/web/20220308184757id_/https://www.macalester.edu/~abeverid/data'
files = [('stormofswords.csv', None, ('csv', {'props': ['weight']}))]
def fetch_upstream(force=False):
[entries] Fix parse bugs and improve the metadata of existing entries c996a0e
From a review of the dataset descriptions against the upstream sources and papers, and from user reports: - parse fixes (wrong edge direction or directedness, shifted or misnamed properties, merged node identities, duplicated or missing edges and nodes, wrong types), e.g. arxiv_citation (the HepTh dates were a copy of the HepPh ones; now from the KDD Cup 2003 data), eu_procurements, foursquare_global, hiv_transmission, genetic_multiplex, gnutella (adds the 05 snapshot), roadnet, macaque_neural, python_dependency - descriptions rewritten from the upstream sources, documenting every property - corrected titles, citations and DOIs, licences (ustream_license typo, the data's own terms), tags and ICON ids - url lists for entries with several sources or dataset pages - SocioPatterns entries moved to the site's new data location, with the daily networks of sp_infectious and sp_primary_school - the Michael Fire entries marked as orphans (served from the mirror) - redundant type forcings removed after the graph-tool coercion fixes
diff --git a/entries/game_thrones/__init__.py b/entries/game_thrones/__init__.py
index f7d4076..9e80d48 100644
--- a/entries/game_thrones/__init__.py
+++ b/entries/game_thrones/__init__.py
@@ -19,8 +19,12 @@
from .. import *
title = "Game of Thrones coappearances"
-description = """Network of coappearances of characters in the Game of Thrones series, by George R. R. Martin, and in particular coappearances in the book \"A Storm of Swords.\" Nodes are unique characters, and edges are weighted by the number of times the two characters' names appeared within 15 words of each other in the text.[^icon]
-[^icon]: Description obtained from the [ICON](https://icon.colorado.edu) project."""
+description = r"""Network of co-occurrences of characters in "A Storm of Swords", the third book of George R. R. Martin's fantasy series "A Song of Ice and Fire" (the basis of the TV series "Game of Thrones"), compiled by A. Beveridge and J. Shan. Nodes are characters, and two characters are connected by an undirected edge whenever their names (or nicknames) appear within 15 words of each other in the text. Only pairs that co-occur at least 4 times are included in the data.
+
+The network has the following properties:
+
+- `name`: the character's name.
+- `weight` (edges): the number of co-occurrences of the two characters."""
tags = ['Social', 'Fictional', 'Weighted']
url = 'http://www.macalester.edu/~abeverid/data/stormofswords.csv'
citation = [('A. Beveridge and J. Shan, "Network of Thrones." Math Horizons 23(4), 18-22 (2016)', 'https://doi.org/10.4169/mathhorizons.23.4.18')]
Update copyright information 73a4f0d
diff --git a/entries/game_thrones/__init__.py b/entries/game_thrones/__init__.py
index e4c2c5f..f7d4076 100644
--- a/entries/game_thrones/__init__.py
+++ b/entries/game_thrones/__init__.py
@@ -1,7 +1,7 @@
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
-# Copyright (C) 2020-2024 Tiago de Paula Peixoto <tiago@skewed.de>
+# 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
Update copyright information 3d288ea
diff --git a/entries/game_thrones/__init__.py b/entries/game_thrones/__init__.py
index 2453790..e4c2c5f 100644
--- a/entries/game_thrones/__init__.py
+++ b/entries/game_thrones/__init__.py
@@ -1,7 +1,7 @@
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
-# Copyright (C) 2020-2023 Tiago de Paula Peixoto <tiago@skewed.de>
+# Copyright (C) 2020-2024 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
Update copyright information 8d005ae
diff --git a/entries/game_thrones/__init__.py b/entries/game_thrones/__init__.py
index 65b50f6..2453790 100644
--- a/entries/game_thrones/__init__.py
+++ b/entries/game_thrones/__init__.py
@@ -1,7 +1,7 @@
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
-# Copyright (C) 2021 Tiago de Paula Peixoto <tiago@skewed.de>
+# Copyright (C) 2020-2023 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
Update copyright info db2efcc
diff --git a/entries/game_thrones/__init__.py b/entries/game_thrones/__init__.py
index 9acce74..65b50f6 100644
--- a/entries/game_thrones/__init__.py
+++ b/entries/game_thrones/__init__.py
@@ -1,7 +1,7 @@
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
-# Copyright (C) 2020 Tiago de Paula Peixoto <tiago@skewed.de>
+# Copyright (C) 2021 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
Update citations to use DOIs e878874
diff --git a/entries/game_thrones/__init__.py b/entries/game_thrones/__init__.py
index ea9415a..9acce74 100644
--- a/entries/game_thrones/__init__.py
+++ b/entries/game_thrones/__init__.py
@@ -23,7 +23,7 @@ description = """Network of coappearances of characters in the Game of Thrones s
[^icon]: Description obtained from the [ICON](https://icon.colorado.edu) project."""
tags = ['Social', 'Fictional', 'Weighted']
url = 'http://www.macalester.edu/~abeverid/data/stormofswords.csv'
-citation = [('A. Beveridge and J. Shan, "Network of Thrones." Math Horizons 23(4), 18-22 (2016)', 'http://www.maa.org/sites/default/files/pdf/Mathhorizons/NetworkofThrones%20%281%29.pdf')]
+citation = [('A. Beveridge and J. Shan, "Network of Thrones." Math Horizons 23(4), 18-22 (2016)', 'https://doi.org/10.4169/mathhorizons.23.4.18')]
icon_hash = '57029012a6d70217090ce009'
upstream_prefix = 'http://www.macalester.edu/~abeverid/data/'
files = [('stormofswords.csv', None, ('csv', {'props': ['weight']}))]
Change license from GPLv3 to AGPLv3 d754be5
diff --git a/entries/game_thrones/__init__.py b/entries/game_thrones/__init__.py
index 3dce615..ea9415a 100644
--- a/entries/game_thrones/__init__.py
+++ b/entries/game_thrones/__init__.py
@@ -3,18 +3,18 @@
#
# Copyright (C) 2020 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 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 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 General Public License for more details.
+# 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 General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
+# 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 *
Add explicit attribution to descriptions obtained from ICON 1645314
diff --git a/entries/game_thrones/__init__.py b/entries/game_thrones/__init__.py
index 29bf03f..3dce615 100644
--- a/entries/game_thrones/__init__.py
+++ b/entries/game_thrones/__init__.py
@@ -19,7 +19,8 @@
from .. import *
title = "Game of Thrones coappearances"
-description = "Network of coappearances of characters in the Game of Thrones series, by George R. R. Martin, and in particular coappearances in the book \"A Storm of Swords.\" Nodes are unique characters, and edges are weighted by the number of times the two characters' names appeared within 15 words of each other in the text."
+description = """Network of coappearances of characters in the Game of Thrones series, by George R. R. Martin, and in particular coappearances in the book \"A Storm of Swords.\" Nodes are unique characters, and edges are weighted by the number of times the two characters' names appeared within 15 words of each other in the text.[^icon]
+[^icon]: Description obtained from the [ICON](https://icon.colorado.edu) project."""
tags = ['Social', 'Fictional', 'Weighted']
url = 'http://www.macalester.edu/~abeverid/data/stormofswords.csv'
citation = [('A. Beveridge and J. Shan, "Network of Thrones." Math Horizons 23(4), 18-22 (2016)', 'http://www.maa.org/sites/default/files/pdf/Mathhorizons/NetworkofThrones%20%281%29.pdf')]
Initial commit cc85872
diff --git a/entries/game_thrones/__init__.py b/entries/game_thrones/__init__.py
new file mode 100644
index 0000000..29bf03f
--- /dev/null
+++ b/entries/game_thrones/__init__.py
@@ -0,0 +1,48 @@
+#! /usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2020 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 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+from .. import *
+
+title = "Game of Thrones coappearances"
+description = "Network of coappearances of characters in the Game of Thrones series, by George R. R. Martin, and in particular coappearances in the book \"A Storm of Swords.\" Nodes are unique characters, and edges are weighted by the number of times the two characters' names appeared within 15 words of each other in the text."
+tags = ['Social', 'Fictional', 'Weighted']
+url = 'http://www.macalester.edu/~abeverid/data/stormofswords.csv'
+citation = [('A. Beveridge and J. Shan, "Network of Thrones." Math Horizons 23(4), 18-22 (2016)', 'http://www.maa.org/sites/default/files/pdf/Mathhorizons/NetworkofThrones%20%281%29.pdf')]
+icon_hash = '57029012a6d70217090ce009'
+upstream_prefix = 'http://www.macalester.edu/~abeverid/data/'
+files = [('stormofswords.csv', None, ('csv', {'props': ['weight']}))]
+
+def fetch_upstream(force=False):
+ return fetch_upstream_files(__name__.split(".")[-1], upstream_prefix, files,
+ force)
+
+@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 = [stack.enter_context(open_upstream_file(name, fn, "rb")) for fn in fnames]
+ g = parse_graph(fs, fmt, directed=False)
+ yield alt, g