This month I’ve been studying network analysis and teaching myself D3.js, and I wanted to post something here which combined the two. So I’ve used D3.js to create a force-directed graph of all the murders which take place in the TV series The Wire.
Each of the coloured nodes is a character in The Wire. Shown are the murdered and the murderers, with the colour indicating how they died (or if they survived). If you click through to the interactive version, you can highlight nodes to see character names, or use the out-degree distribution barchart to select characters by the number of murders they committed. You can also double-click on any character to foreground their immediate network.
There are a few isolated nodes: these are characters who were murdered by unknown assailants. Also, not quite every murder is shown: there are some deaths which are talked about as having taken place before Season 1 begins or which took place off camera and can’t be clearly attributed, etc., etc… Basically, there were some that were so vague I just left them out.
This is a very simple network and it doesn’t lend itself to any fancy network analysis algorithms (for that, see next month’s post on the social network of words in a thesaurus). But what the chart does do, by mere act of visualisation, is bring to our attention part of the bigger picture which we may not have apprehended as we sat through the many episodes of The Wire.
I’ll just point out three characters, starting with the two largest components:
Three charactes, in particular, were extremely prolific murderers. Their crowded hubs are the first things you notice when you look at the graph. Between them, the three committed 81 murders – roughly two-thirds of all murders in the entire five seasons of The Wire. The two large blue nodes (above left) are Snoop Pearson and Chris Partlow. These two are enforcers working for drug lord Marlo Stanfield; they murder a lot of people in Season 4 and board up the bodies in abandoned houses.
The pink node at the centre of a star formation is Sam, a crewman on the ship Atlantic Light and part of The Greek’s smuggling organisation. In Season 2 he sealed a group of illegal immigrants in a shipping container and left them to suffocate.
Perhaps the most interesting formation is the chain shown above. This is more like what I imagined before I plotted it: so-and-so murdered so-and-so, who was murdered by so-and-so, who was in turn murdered by so-and-so… HBO shows are kinda like that. One of the green nodes is fan favourite Omar Little. He was killed by Kenard (the little runt!), but not before he killed Anton ‘Stinkum’ Artis, who, in turn, had previously killed Brandon Wright… So it goes.
I was hoping that more of the network might take this form: chains of murders. If it were more complicated we could ask analytic questions such as, “Which character, if removed, would save the most lives?” But, it turns out that the answer to that question is obvious because so many murders were committed by only a couple of characters.
There are many other formations you can find, illustrating the many different ways that characters in The Wire get violent with one-another:
- The data was sourced from The Wire HBO TV Wiki
- The chart owes a debt of gratitude to the talented Mike Bostock, creator of D3. This was my first D3 visualisation, and to make it work I drew inspiration (OK, I looted) a number of Mike’s generous examples. Most egregiously, I looted from his Force-Directed Graph, Force Directed Graph with Directionality and Force-Directed Graph with Mouseover.
- Finally, for anyone who plans to implement their own network plot in D3, this review of the many A to Z of extra features for the D3 force layout is invaluable.