Visualize the graph
Now that we've thought a bit about how we constructed our network, let's size our graph and make an initial visualization. Before you make the plot, you'll calculate the number of vertices and edges. This allows you to know if you can actually plot the entire network. Also, the ratio of nodes to edges will give you an intuition of just how dense or sparse your plot might be. As you create your plot, take a moment to hypothesize what you think the plot will look like based on these metrics.
This exercise is part of the course
Case Studies: Network Analysis in R
Exercise instructions
- Calculate the number of nodes of the graph
retweet_graph
usinggorder()
. - Calculate the number of edges of the graph
retweet_graph
usinggsize()
. - Calculate graph density of the graph
retweet_graph
usinggraph.density()
. - Plot the retweet network
retweet_graph
.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Count the number of nodes in retweet_graph
___
# Count the number of edges in retweet_graph
___
# Calculate the graph density of retweet_graph
___
# Plot retweet_graph
plot(___)