A graph analysis of Skyrim connections

Using a wikipedia link dataset, I made a complex network of Skyrim's cities, quests and NPCs to understand how they are organized.

For the past weeks, I have been playing around the Skyrim's Fandom wiki dump, which I had downloaded as a case study for building a RAG layer for local LLMs. However, while I used the full page's body text to create this RAG system, many other types of information could have been exported from the database, such as tables, sections, and links. Indeed, I left a note stating that a more comprehensive analysis of the page could be a future work.

In particular, I was interested in exploring the relationship between different pages and how different NPCs interact with each other. For this purpose, I decided to put the networkx package to use and build a graph to explore a few metrics from this complex network. The graph has all the nodes related to NPCs, Cities and major locations, and quests.

The graph has three types of nodes, representing the NPCs (circle), quests (triangles), and cities (square). The plot is made using networkx plotting functionality with force_atlas2_layout function to organize the nodes. The node size is given by its degree_centrality and the color is the node's community from a greedy_modularity_communities.

Cities

The most central elements are, of course, the cities, which function as hubs to find new people and identify new quests and things to do. In terms of degree_centrality (people to see and things to do), Riften takes the top along with Solitude.

titledegree_centrality
Riften0.1
Solitude0.1
Whiterun (city)0.09
Markarth0.08
Windhelm0.08
Raven Rock0.04
Dawnstar0.04
Morthal0.03
Falkreath (city)0.03
Riverwood0.03

NPCs

Next, we see how the NPCs are scattered around the world. In the game, the NPCs and quests have factions associated with them. Coloring the nodes by the faction highlights how they are organized, showing that NPCs from the same factions stick close together.

It's interesting to see that NPCs related to the College of Winterhold and the Dawnguard NPCs stay distant from the main hubs. In contrast, the NPCs related to the civil war (Imperial Legion and Stormcloak) stay closer to the center of the plot.

Highly connected NPCs

Let's check who the network says are the characters the player will likely encounter. For this purpose, we employ the degree centrality to see due to how connected they are to many factions of the game. Indeed, Delvin Mallory is a quest-giver from the Thieves Guild, which provides quests that often combine several places and people. Next, there is Ulfric Stormcloak, the leader of the rebellion, followed by Nazir from the Dark Brotherhood and Alduin, the main antagonist.

NPCfactionracedegree_centrality
Delvin MalloryThieves' GuildBreton0.023
Ulfric StormcloakStormcloaksNord0.023
NazirDark BrotherhoodRedguard0.020
AlduinDragon0.019
Maven Black-BriarBlack-BriarNord0.018
Mercer FreyThieves' GuildBreton0.017
General TulliusImperial LegionImperial0.017

Bridges NPCs

However, some NPCs play a crucial role in allowing the player to interact with more close-off factions. Sorting NPCs by the betweenness_centrality highlights a few names, such as Glover Mallory (Dragonborn DLC), Serana (Dawnguard DLC), Neloth (Dragonborn DLC), and Sinding, who is crucial in the Ill Met by Moonlight quest.

titlefactionbetweenness_centrality
Glover Mallory0.036
Delvin MalloryThieves' Guild0.017
Neloth0.016
Serana0.015
NazirDark Brotherhood0.015
Alduin0.013
Sinding0.012

Quests

Let's focus on the quests and their factions, then. We plot the title of the top 95% betweenness_centrality quests.

Quests that glue the world together

Those are the quests that are highly central and connect different parts of the map:

Questfactionbetweenness_centrality
No Stone UnturnedThieves' Guild0.069
Season Unending0.043
The Fishing JobThieves' Guild0.036
The Final Descent0.032
Reluctant Steward0.030
The Dark Brotherhood ForeverDark Brotherhood0.028
Prophet (Vampires)Clan Volkihar0.024
Revealing the Unseen (quest)College of Winterhold0.023
The Staff of Magnus (quest)College of Winterhold0.022
The HuntClan Volkihar0.022

By far the No Stone Unturned is the most central quest, as it involves finding and gathering gemstones scattered around the map. The Season Unending is about stopping the civil war, again, involving several places and NPCs.

In terms of factions, the Thieves' Guild is again one of the most connected ones using degree_centrality, followed by the civil war factions and the Dark Brotherhood.

factiondegree_centrality
Thieves' Guild0.0067
Stormcloaks0.0067
Imperial0.0061
Dark Brotherhood0.0059
Blades0.0050

However, using the betweenness_centrality, it highlights the quest from factions in the periphery of our network, such as the ones introduced by the Dawnguard DLC and the College of Winterhold, famously cast away from the rest of Skyrim {target="_blank"}.

factionbetweenness_centrality
Clan Volkihar0.0078
Thieves' Guild0.0070
Dawnguard0.0042
College of Winterhold0.0036
Dark Brotherhood0.0035

Clusters

Finally, here are the major relationships between the community structure and the game's content.

The highlights are:

  • College of Winterhold castaway status is reflected in the community structure of the network, where the members are highly connected to themselves, sharing not that many connections with the outside.
  • The Dragonborn DLC content is on a new map, accessible by ship only. As a result, it displays a large community with few bridges.
  • In contrast, the Dawnguard DLC stays on the original map, sharing much more references with the rest of the game. Still, the new content most often interact with itself than the rest of the map, forming a community.
  • The Forsworn faction and its content is pretty much restricted to Markarth. The same also happens with some members and quests of the Thieves' Guild being adjacent to Riften or the Gray-Mane in Whiterun.
  • There is a cluster near Falkreath related to the Sinding's quest (Ill Met by Moonlight). It's interesting to see it displayed so distinctively in the network, as when I first played it many years ago, I also did find it unique: as it seemed like there was much more effort put into it than the rest of the quests in the game.

Concluding remarks

It has been fun employing somewhat complex or advanced concepts to silly ideas, such as building that RAG layer for Skyrim or putting the effort into understanding how Skyrim is organized. Despite the silliness, I find it's good to keep practicing concepts I learned some time ago.

Additionally, I am also trying to practice the process of setting up goals, creating projects, implementing them to the end, and reporting results. So making a blog sharing nonsense projects I spend my on seems like a good opportunity to keep practicing and exercising creativity.