graphTweets not only allows to build graphs of interactions between users. It also lets you visualise what hashtag users use in their tweets and which hashtags are used together in the same tweets.
We can also build networks of co-mentions where users that are @tagged in the same tweet are connected. We’ll collect more tweets, with a slightly different queries to ensure that the tweets include @mentions.
When preparing the graph we simply pass
mentions_screen_name instead of
hashtags as we did before.
net <- tweets_mentions %>% gt_co_edges(mentions_screen_name) %>% gt_nodes() %>% gt_collect() c(edges, nodes) %<-% net edges <- edges %>% mutate(id = 1:n()) nodes <- nodes %>% mutate( id = nodes, label = id, size = n ) sigmajs() %>% sg_nodes(nodes, id, label, size) %>% sg_edges(edges, id, source, target) %>% sg_cluster( colors = c( "#0084b4", "#00aced", "#1dcaff", "#c0deed" ) ) %>% sg_layout(layout = igraph::layout.fruchterman.reingold) %>% sg_neighbours() %>% sg_settings( maxNodeSize = 3, defaultEdgeColor = "#a3a3a3", edgeColor = "default" )