# 5 Graphs

Before we get on with the graphs let’s go through the types of graphs that the *twinetverse*, through graphTweets, allows you to build.

## 5.1 Anatomy

To explain the graphs let’s first look at the anatomy of a basic tweet.

Introducing the #rstats {twinetverse} package; everything you need to collect, build, and visualise #twitter interactions. In depth documentation thanks to @xieyihui {bookdown}: https://t.co/Sf5WdI8m6p pic.twitter.com/GxDSeWpqJL

— John Coene (@jdatap) July 26, 2018

The above tweet is posted by a user (@jdatap), the tweet uses a hashtag (#rstats and #twitter) and @tags another user (@xieyihui, the creator of bookdown (Xie 2018) which is used to write this very book). #hashtags and @users are the core components of tweets that the *twinetverse* looks into.

## 5.2 Types

### 5.2.1 1. Conversations

If we were to try to understand **how users communicate with one another** on a given topic, we could build a graph where each user is a node (disk/point), which are linked together (edges) when one has @tagged another in a tweet. Thereby visualising who discusses with who.

So using our tweet above as example: @jdatap -> @xieyihui.

### 5.2.2 2. Retweets

Using retweets we can understand **how information spreads** throughout the Twitter network. In this graph, each node is a user who is connected to other users who he retweeted.

### 5.2.3 3. Co-mentions

We can also build networks of co-mentions, for both users and hashtags. On these networks, nodes are connected when they are mentioned together in the same tweet. This reveals clusters (of users or hashtags)

A network of hashtags co-mentions with our tweet above would result in: #rstats -> #twitter.

Conversations and Retweets graphs (1, 2) are directed while co-mentions (3) are undirected.

Finally, graphTweets provides functions to bind edges together, so you can combine any the of the networks mentioned above. We will explore all of the graphs discussed here throughout the book.

### References

Xie, Yihui. 2018. *Bookdown: Authoring Books and Technical Documents with R Markdown*. https://CRAN.R-project.org/package=bookdown.