Skip to content

Commit

Permalink
added gossip network to report #62
Browse files Browse the repository at this point in the history
  • Loading branch information
Nils Reiter committed Nov 10, 2017
1 parent 2fd7c0e commit f3b588f
Showing 1 changed file with 38 additions and 1 deletion.
39 changes: 38 additions & 1 deletion inst/rmd/Report.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,13 @@ barplot(c$matrix,
```


# Copresence Network
# Network Analysis {.tabset}

## Copresence Network

In a copresence network, two vertices are connected if the characters they represent appear together on stage (= are co-present on stage). The network shown here is based on scenes, i.e., the thicker an edge, the more scenes the two connected characters are copresent.


```{r, echo=FALSE, message=FALSE}
c <- configuration(mtext, onlyPresence = TRUE, by="Scene")
co <- c$matrix %*% t(c$matrix)
Expand All @@ -144,6 +150,37 @@ plot.igraph(g,
)
```

## Gossip Network

The "gossip network" represents character that talk about other characters. The colors don't follow a particular pattern and are just added for readability. Edge thickness represent how often (number of scenes) this happens, and is scaled logarithmically.
Currently, this includes scenes in which both characters are present. This will be changed later.

```{r, echo=FALSE}
m <- as.matrix(
as.data.frame.matrix(
xtabs( ~ Speaker.figure_id + Mentioned.figure_id,
mtext[,.N,.(Speaker.figure_id,Mentioned.figure_id,begin.Scene)]
[!is.na(Mentioned.figure_id)])))
g <- graph_from_adjacency_matrix(m,
weighted=TRUE, # weighted graph
mode="directed", # no direction
diag=FALSE # no looping edges
)
coords <- layout_(g, on_grid())
plot.igraph(g,
layout=coords, # how to lay out the graph
vertex.label.cex=0.6, # label size
vertex.label.color="black", # font color
vertex.color=qd.colors[4], # vertex color
vertex.frame.color=NA, # no vertex border
edge.curved = TRUE, # curved edges
edge.width=log(E(g)$weight)+1, # scale edges according to their weight
edge.color=rep(qd.colors,100)
)
```


# Word Fields {.tabset}

Expand Down

0 comments on commit f3b588f

Please sign in to comment.