Chapter 3 Network Structure
Now, we can start to explore the network structure. First of all, we can check the number of nodes and edges.
# Number of nodes
igraph::vcount(network)
n_nodes <- igraph::ecount(network)
n_edges <-print(paste("Number of nodes:", n_nodes))
## [1] "Number of nodes: 563"
print(paste("Number of edges:", n_edges))
## [1] "Number of edges: 75120"
In network science, the number of nodes and edges is not enough to describe the network. We need to check the density of the network. The density of a network is the ratio between the number of edges and the maximum number of edges. The maximum number of edges is the number of nodes multiplied by the number of nodes minus one. It returns a value comprised between 0 and 1. The closer the density is to 1, the more dense the network is. The closer the density is to 0, the more sparse the network is.
# Density of the network
igraph::edge_density(network)
density <-print(paste("Density of the network:", density))
## [1] "Density of the network: 0.237416483884629"
Overall, the network is not very dense. It means that the network overall is not very connected. However, we can check the density of the network for each party.
# Density of the network for each party
# density_party <- igraph::edge_density(network, membership = nodes$party)
# print(paste("Density of the network for each party:", density_party))
Additionally, we can take a look at the diameter of the network. The diameter of a network is the maximum distance between two nodes. The distance can also be understood in social terms as the social distance (the number of steps) from one node to another. It is also called the geodesic distance.
farthest_vertices(network)
## $vertices
## + 2/563 vertices, named, from 3d5283d:
## [1] secelainechao guamcongressman
##
## $distance
## [1] 6
In our case, the diameter of the network is 6 and the farthest vertices are those between Elaine Chao, who served as member of the Trump Cabinet as secretary of transportation and Michael San Nicolas, Democratic member of the House of Representatives from the Guam at-large district.