Graph Visualization Software for Networks of Characters in Plays

The Stanford Literary Laboratory has recently proposed the study of literature in the framework of network theories. The analysis is based on the fact that plots of plays or novels can be displayed as networks of interacting characters. Following this approach, we apply the Graph Visualization Software to two Shakespeare’s plays to show how it can help in highlighting some features of their plots and display their timelines.


Introduction
The Stanford Literary Laboratory, founded in 2010 by M. Jockers and F. Moretti, is proposing the use of computers in the analysis of literary works, with the main goal of determining some quantitative and partially automatic parameters for literature [1].Among the researches of this laboratory we find also the plot analysis of plays using the network graph theory [2].For instance, we can see the structure of plots displayed by graphs with nodes and edges.The nodes are the characters and the edges are the actions among them.Following this Stanford Laboratory proposal, the plots of Shakespeare's Hamlet and of the first novel of Harry Potter's series have been discussed in a previous paper [3], showing that their associated networks can be considered as portions of some small-world networks [4][5][6].
To illustrate his approach to literary works, Franco Moretti, one of the founders of the Laboratory, used in the Reference 2 several graphs of the Hamlet's network.In his paper [2], the author does not tell how these graphs have been prepared, by hand-drawing or by using a computer.Here, we suggest to apply the Graph Visualization Software to such a literature analysis; in particular, we will use the software for two Shakespeare's plays, showing that it can help in highlighting some features of their plots.We will see that it is also quite useful in displaying the timeline of the plot in a planar graph.

Graph Visualization Software
Graphviz, that is the Graph Visualization Software, is a package of open-source tools for drawing graphs specified in DOT language scripts [7].It also provides libraries for software applications to use the tools.Graphviz is free software licensed under the Eclipse Public License, available at the Web address http://graphviz.org/.Among the several applications of it, let us remember its use in bioinformatics, to create pedigrees [8].The software consists of a quite simple description language of graph [9]; using it, we can prepare graphs with several architectures: for instance, with the "circo" layout we can have a circular graph.
Since we want to use Graphviz in the analysis of the plots of plays, let us remark some facts concerning this application.A network and its graph are made of nodes and edges; a plot is made of characters and actions.The characters will be the nodes of the network, whereas interactions are the edges [2].In the Moretti's analysis, a link exists between two characters if some words have passed between them.
Moretti is also stressing that weight and direction are particularly important in literary networks.Actually, he explains that "whereas the systems studied by network theory have easily thousands or millions of vertices, whose relevance can be directly expressed in the number of connections, plots have usually no more than a few dozen characters; as a consequence, the mere existence of a connection is seldom sufficient to establish a hierarchy, and must be integrated with other measurements" [2].This means that some analyses on the network of a plot, besides displaying it with a graph, are necessary as discussed in [3].

Hamlet and Othello graphs
The aim of this paper is the graph visualization of plots using Graphviz.First of all, let us choose a graph with links without weight, direction or labels.All the characters are nodes of the network.Two characters are linked if some words, no matter how many, have passed between them during the play.In the Figure 1 The protagonist is Hamlet, son of the recently deceased King (who is appearing in the play as the Ghost), and nephew of King Claudius, his father's brother and successor.Claudius hastily married King Hamlet's widow, Gertrude, Hamlet's mother.In the graph, we see immediately that Hamlet and Claudius are the two "hubs", and about them all the play is revolving.Gertrude is placed by Graphviz between Hamlet and Claudius.The other female character, Ophelia, has just a few links.
As previously told, the graph in Figure 1 is created with a node for each character, and characters linked when some words have passed between them.We can create a more specific graph, using labels on the links, telling in which act and scene there was an interaction between characters.In the Figure 2, the new graph is shown.Again, for the reader convenience a high-resolution image of the Figure 2 is provided at same Web address given for Figure 1.As we can see, the software allows an easy display of the timeline of the plot in a planar graph.
Software Graphviz has several layouts: the standard graph we see in the Figure 1 becomes, using the "circo" layout, that shown in the Figure 3.In the Figure 4 and 5, we repeated the network analysis for "The Tragedy of Othello, the Moor of Venice".The work revolves around four central characters: Othello, a Moorish general in the Venetian army, his new wife, Desdemona, his lieutenant, Cassio, and his trusted officer, Iago.In the Figure 6, the graph of Figure 4 is shown with the layout "circle".

Discussion
As remarked by Moretti [2], the use of network graphs makes visible specific "regions" within the plot as a whole.It is easy to see if subsystems exist, which share some significant property.Let us consider for instance the characters that are connected to both Claudius and Hamlet: "except for Osric and Horatio, whose link to Claudius is however extremely tenuous, they are all killed ... The tragedy, is all there" [2].For what concerns the protagonist, in the network theory this figure is the character that minimizes the sum of the distances to all other nodes, and therefore is the center of the network [2].In the case of the Hamlet tragedy, this is Hamlet.
After displaying the graph of the tragedy, we see that it is composed of a system of regions, and that a hierarchy of centrality exists among characters.Therefore, we can work on the graph and investigate what could be the plot without the protagonist; in the case of the Figure 1, without Hamlet.Let us take the network and remove the node Hamlet in the following way.Using Graphviz we can draw the Hamlet's links with the color white: in this manner, the nodes of the network do not change their positions in the graph.The result is the image shown in the Figure 7.As Moretti wrote in [2], when Hamlet is removed, the network almost splits in half, with the court on the left, and the region that includes the Ghost and Horatio on the right.As a conclusion, we see that Hamlet is the protagonist because, besides being central, he is important for the stability of the network too [2].
In any case, centrality does not give stability: let us "take the second most central character of the play: Claudius.In quantitative terms, Claudius is almost as central as Hamlet; but in structural terms not so, when we remove him from the network (Figure 8) what happens is that a handful of peripheral characters are affected, but the network as a whole not much" [2].This is true, but this tragedy is meaningless without Claudius, because he is the antagonist of Hamlet.
For what concerns the periphery of the network, it is better to discuss it using the "circo" layout (Figures 3  and 6).As we can easily see, the periphery is composed by those characters having just one link.If we are talking about Hamlet, "as a group, these peripheral characters do something unique; they point to the world beyond Elsinore: the gentleman, sailor and ambassadors who speak to Horatio, and one of the messengers to Claudius, are links to the "English" subplot, Cornelius and Voltemand to "Norway", Reynaldo to Laertes's "France", the Priest and Gravedigger to the world of the dead.These centrifugal threads -"tendrils", as they're sometimes calledcontribute to the uncanny feeling that Elsinore is just the tip of the tragic iceberg: geography as the hidden dimension of fate, like genealogy in Greek tragedy" [2].We could repeat the same for Othello's network, changing names and georeferences.Therefore, the tendrils represent all the links connecting the characters to a real-world network.As shown in Reference 3, the addition of several other single links is rendering the network a small-world network.

Conclusion
In this paper we have applied Graphviz, the Graph Visualization Software, which is a package of opensource tools, for representing the plots of plays with graphs.We prepared some graphs with the standard and the "circo" layouts of Shakespeare's Hamlet and Othello tragedies.The characters are the nodes of the graphs, whereas interactions are the edges or links.The characters are linked when some words have passed between them.Besides the general network that we can obtain from the plot, we can have a more detailed network, where the edges have a label telling the act and scene during which there was the http://www.ijSciences.comVolume 3 -February 2014 (2) 71 interaction between characters.Graphviz is so simple to use, that we can easily modify the network to test its stability and highlight the role of the central characters.
, we see the network created by Graphviz for the Shakespeare's play "The Tragedy of Hamlet, Prince of Denmark".The nodes Hamlet and Claudius are encircled in red.For the reader convenience a http://www.ijSciences.comVolume 3 -February 2014 (2) 70 high-resolution image of the graph in Figure 1 is provided at staff.polito.it/amelia.sparavigna/Shakespeare.

Figure 8 -
Figure 8 -The network of characters in the Shakespeare's Hamlet, without Claudius.His links are plotted using the white color.Therefore, the positions of the nodes do not change.