Skip to content

A Network Analysis of Shakespeare’s Plays

What if Hamlet’s “To be or not to be” soliloquy looked like this:

Figure 1 (1)

Rather than like this?

Figure 28

For the past two years, I have been working on ways to do precisely this, by using social network analysis and theory as a way to study literary texts. I’ve examined Shakespeare’s plays to demonstrate how network visualization is a digital humanities method that can “explore” and “negotiate” the space between text and performance in the study of drama, to borrow terms from the Shakespeare critic Robert Weimann. In this approach, digital techniques serve as a way to link traditionally different modes of reading and literary criticism, such as, in the case of Shakespeare, the literary text and theatrical performance. The networks developed in this project use the language of Shakespearean plays to trace the relationships between characters in space, in effect, translating the literary text into a web of spatial relations, which are difficult to perceive solely in the act of reading. The network visualizations map out the connections between every character in all of Shakespeare’s thirty-seven plays at different scales – from the entire play to the individual scene to the line – by counting how much a character speaks (the size of the node), whom they speak to (the edges between the nodes), and how frequently characters interact (the distance between the nodes).

To validate our method, I’ve compared the network diagrams to actual performances by the Royal Shakespeare Company to show that the density or sparseness of each play’s network, and the proximity and distance of the characters composing that network, correspond to the positioning and arrangement of the actors’ bodies on stage. This homology between the network and the embodied performance is logical because each character’s speech structures their relationship to others, and frames their physical interaction in the space of the stage. There are, of course, exceptions to this trend (dumbshows, asides, and eavesdropping scenes are some of the obvious examples), and the network can by no means function as an exact template for a performance. However, the network visualizations used in this analysis serve as a stable and reproducible way, beyond any single performance, to delineate how the language of Shakespeare’s plays structures the relationships of characters in space. This research represents the beginning of a digital method that aims to bridge text and performance in the study of Shakespeare by reading the dramatic text for the linguistic codes that organize the space of the stage.

The network thus offers to us a model of the social that does not rely on the ordered arrangements of hierarchies, institutions, ranks, categories, or taxonomies. Networks describe the social order in a seemingly chaotic, unordered way, where the linguistic transactions between actors in the network empirically determine the nature of the social structure in the first place, without any formal, a priori presupposition of what the social organization should look like. Thus, if conceptualized in the form of the network, our introduction to the fractured political world of Elsinore looks something like this:

Figure 1. Hamlet, Act 1, Scene 2.

The network organizes the competing factions in space, organized around the hubs of Hamlet and Claudius, with Gertrude caught in between. This more closely matches the experience of spectators who would first encounter power relationships by inferring spatial and linguistic interactions between characters, and would have to figure out for themselves the tensions and allegiances driving the play’s plot. By contrast, modern text editions, such as the Oxford Shakespeare shown in Figure 2, provide the reader with a neat organization classified by rank, nationality, gender, heredity, or among other rubrics, in the form of a cast of characters, which was not provided to Renaissance audiences, or many theatergoers today.

Figure 2. Cast of Characters from the Oxford Shakespeare.

Unlike the seemingly codified hierarchy of the cast of characters, the social relationships visualized in the network are not static. The network captures the ephemeral dynamism of unstable and constantly shifting social vectors. It is defined by its actors and their movements structuring relationships in a web.
To trace the relationships between characters in all of Shakespeare’s plays, we created visualizations using the Python library NetworkX, which has been used by scientists to examine complex systems and by social scientists to visualize social media networks. The algorithms created to make the networks quantify the number of words and lines spoken by each character, which other characters they speak to, and how frequently the two characters interact. The resulting network visualizations aggregate all of the individual relationships into a web of spatial relationships between all of the characters present in a scene, and within each play as a whole. In constructing these networks embedded within Shakespeare’s plays, we have adopted the model of quantitative network theory, which defines a social network as “a set of people or groups of people with some pattern of contacts or interactions between them.”
Within the network, the radius of each node is scaled according to the number of lines that the character speaks – the larger the node, the more she dominates the scene (or the unit of text being analyzed) with her language. The edges between the nodes signify the relationship of each character to others, or whom they address in the text’s language. The distance between the nodes signifies the inverse of the frequency of characters speaking to one another. More interaction between characters in the text will move their nodes closer together and will reduce the length of the edge between them. Comparing the number of edges linking a character to others and the distance between the character and their interlocutors allows us to perceive the network density surrounding each character. Increasing the number of links connecting a character to others, and drawing the edges closer to one another, create an effect of network density that indicates a high frequency and intensity of network connectedness and social interaction. Scenes with a great deal of interaction will display a dense network of character nodes that are tightly clustered together. Scenes with fewer interactions among characters result in a sparse network with few connections between distant nodes. The tool also provides quantitative metrics of the lines spoken by each character within the scene or play (which determines the size of the speaker’s node) and how many links a character has to others (measuring the density of network connections around each character). The network visualization method transforms the language of Shakespeare’s plays into an array of spatial relationships structuring the network based on four different measurements. Each network, therefore, layers four dimensions of textual information – volume of speech, connections to other characters, frequency of interaction with other characters, and network density – into a single visualization. This four-tiered approach devised to create a network of Shakespeare’s plays opens up a new method using visualization technologies as a way to study a literary text from multiple angles simultaneously in a single network diagram.

As a form of methodological control to verify the accuracy of the visualizations, let us first compare the network graphs with the playtext and with still images from performances, to evaluate if the networks correspond to the plot and dramatization of the plays. To start with the play most frequently performed by the Royal Shakespeare Company, and to sharpen the contrast with the Stanford Literary Lab’s reading of the play, consider Act 1, Scene 2 from Hamlet. In this scene, Prince Hamlet famously declares that he has “that within which passeth show,” which has been taken by generations of critics interested in Hamlet’s subjectivity as an emphatic declaration of a metaphysical interiority. For all of Hamlet’s insistence on “that within,” the language of the scene plays with the social proximity and distance between each character to establish intersubjective filial and political tensions.

The network graph accurately captures the social rupture between the different factions in Elsinore.

Figure 3. Hamlet, Act 1, Scene 2. Network diagram.
Figure 4. Hamlet, Act 1, Scene 2. Quantification of network data.

We can clearly see who is allied with whom: Claudius is networked with Gertrude, Polonius, Laertes, and Cornelius (accompanied by the unspeaking Valtemand), and Hamlet takes up a position in the other sector of the network in relationships with Horatio and Marcellus (accompanied by Barnardo designated by “All” when speaking in unison with Marcellus). As a form of methodological verification, this division of the characters into two sub-networks focalized around Hamlet and Claudius corresponds to the plot of the scene, which represents to the audience for the first time the rupture between two factions at Elsinore. The network graph also visualizes the power struggle between Claudius and Hamlet, with both characters dominating the scene with their volume of speech in almost a 1:1 ratio (Hamlet’s 105 lines : Claudius’s 95 lines). The adversaries possess the same number of network connections, dividing Elsinore into two groups with competing loyalties. The parity of speech quantity and network relations demonstrates a stalemate dividing Elsinore that is the basic problem at the outset of the play. The division of the network into two factions is stark. No member of each sub-network affiliated with Hamlet or Claudius interacts with any member of the opposing faction except for Gertrude. The network accurately shows Gertrude’s conflicted position caught between Hamlet and Claudius, indicating that she directs an equal amount of speech to both in the playtext. As the only character who interacts with both Claudius and Hamlet in the network, her crisis of familial affiliation stands out among the scene’s partitioned social connections.

We are now in a position to verify that the network graph is indeed representing something accurate about the play’s narrative by comparing it to images of the play being performed. In this still captured from the 2009 BBC Production of Hamlet performed by the Royal Shakespeare Company, the physical arrangement of the bodies in the hall reflects the division of characters seen above in the network.

Figure 5. Hamlet, Act 1, Scene 2. 2009 BBC Production.

The RSC performance divides Elsinore spatially in precisely the same way as the network, with Polonius, Laertes, and other members of court positioned behind Claudius at the center of the frame, and with Hamlet distant from all other characters except for Gertrude and Claudius, with whom he interacts. The composition of the scene therefore makes physical distance a measurement of social interaction, as the network does. The closer that Hamlet and Claudius are in space to different characters, the more that they interact with them, and Hamlet’s distance from other members of the court signify his lack of direct engagement. The RSC’s performance also captures Gertrude’s struggle caught between Hamlet and Claudius. Her position in the scene between Hamlet and Claudius directly corresponds to the network’s triangulation of Gertrude equidistant between the two antagonists. The performance exaggerates Gertrude’s filial conflict even further by making all of the actors’ position in the frame largely static throughout the scene, with Gertrude moving in space, shuttling back and forth between Hamlet and Claudius, as indicated by her dynamic gestures in the still image.

But where are Horatio, Marcellus, and Barnardo? In the first phase of the scene, Hamlet and Claudius dominate the action, and in the second, Hamlet confers with his allies about the appearance of the ghost. The performance portrays the second phase of the scene:

Figure 6. Hamlet, Act 1, Scene 2. 2009 BBC Production.

Hamlet’s proximity to the two guards and Horatio clustered around him matches the triangular sub-network in the scene-level network graph. Comparing the network in to the performance prompts us to recognize that the network visualization is a composite aggregating the relationships delineated in the scene’s two separate phases: Hamlet’s vexed relationship with Claudius and the court from lines 1-128, and subsequently speaking about the appearance of his father’s with his allies between lines 159-257. The network visualization tracing character relationships at the level of the scene therefore works at two levels of scale. The network represents the connectedness of characters in the scene as a whole, and it also pieces together a network of micro-networks that compose the different phases of the scene, in effect superimposing the scene’s two separate parts into a single network of social connections.

The preceding analysis of Hamlet serves as the beginnings of a methodological verification. The network visualization reflects the narrative structure of the scene accurately: the social divisions between factions at Elsinore, the distance of characters signifying political and filial rupture, Gertrude’s position torn between Claudius and Hamlet, and Hamlet confiding with his allies in a second phase of the scene. A comparison with the film images also shows that the network graph is a composite of smaller micro-networks that make up the different parts of the dramatic action in a scene. This composite network as a superimposition of micro-networks captures the various social connections in a scene accurately. Act 1, Scene 2 was chosen since it contains the utterance of “that within” that has been traditionally been taken to evince his distinctive, reflexive selfhood. However, the networks show that Hamlet’s singular status as an individual and as an interiorized subject exists in tension with the extent to which he is persistently enmeshed in a social network. The network itself is composed of the characters’ speech and the interactions framed by their speech, measuring the textual discourse of who speaks to whom, how frequently, and beginning to map out the position of the characters in relation to one another in the space of performance. Importantly, however, this analysis of the discourse also accurately conforms to the plot of the scene – the social relationships traced by the network as proximity and distance in space match the tensions, allegiances, and interactions depicted in the plot. In the next blog post, we will explore new insights about Shakespeare’s plays that the network method opens up.

Leave a Reply