A closer look into Airport data networks in the United States.
load(file = "USAirports.rda")
ls()
[1] "network_edgelist" "network_igraph" "network_nodes"
[4] "network_statnet"
vcount(network_igraph)
[1] 755
ecount(network_igraph)
[1] 23473
print(network_statnet)
Network attributes:
vertices = 755
directed = TRUE
hyper = FALSE
loops = FALSE
multiple = FALSE
bipartite = FALSE
total edges= 8228
missing edges= 0
non-missing edges= 8228
Vertex attribute names:
City Distance vertex.names
Edge attribute names not shown
#print(network_igraph)
plot(network_statnet)
Right off the bat, it looks like the igraph and statnet variables are showing different edges. The network igraph is showing 755 nodes and 23473 edges. The network statnet is showing 755 nodes, and 8228 edges.
is_bipartite(network_igraph)
[1] FALSE
is_directed(network_igraph)
[1] TRUE
is_weighted(network_igraph)
[1] FALSE
Using the Network Igraph set, we have a single mode network, which is directed, and is not weighted.
vertex_attr_names(network_igraph)
[1] "name" "City" "Position"
network::list.vertex.attributes(network_statnet)
[1] "City" "Distance" "na" "vertex.names"
edge_attr_names(network_igraph)
[1] "Carrier" "Departures" "Seats" "Passengers" "Aircraft"
[6] "Distance"
network::list.edge.attributes(network_statnet)
[1] "Aircraft" "Carrier" "Departures" "Distance" "na"
[6] "Passangers" "Seats" "weight"
Igraph Attribute Names: name, City, Position
Igraph edge names: Carrier, Departures, Seats, Passengers, Aircraft, Distance
Statnet attribute names: City, Distance, na, vertex.names
statnet edge names: Aircraft, Carrier, Departures, Distance, na, Passangers, Seats, weight
[1] "BGR" "BOS" "ANC" "JFK" "LAS" "MIA"
[1] "Bangor, ME" "Boston, MA" "Anchorage, AK" "New York, NY"
[5] "Las Vegas, NV" "Miami, FL"
[1] "N444827 W0684941" "N422152 W0710019" "N611028 W1495947"
[4] "N403823 W0734644" "N360449 W1150908" "N254736 W0801726"
(network_igraph)$Carrier %>% head()
NULL
head(network_statnet %v% "vertex.names")
[1] "1G4" "A23" "A27" "A29" "ABE" "ABI"
head(network_statnet %v% "City")
[1] "Bangor, ME" "Boston, MA" "Anchorage, AK" "New York, NY"
[5] "Las Vegas, NV" "Miami, FL"
head(network_statnet %e% "weight")
[1] "193" "253" "141" "3135" "4097" "1353"
Min. 1st Qu. Median Mean 3rd Qu. Max.
0 223 496 639 903 6089
summary(network_statnet %e% "Distance")
Length Class Mode
8228 character character
dyad.census(network_igraph)
$mut
[1] 10449
$asym
[1] 2574
$null
[1] 271612
sna::dyad.census(network_statnet)
Mut Asym Null
[1,] 3605 1018 280012
triad.census(network_igraph)
[1] 68169544 665870 2427052 1445 1289 2465 15322
[8] 19171 91 39 114868 202 376 558
[15] 6422 18671
sna::triad.census(network_statnet)
003 012 102 021D 021U 021C 111D 111U 030T 030C
[1,] 68169544 712579 2380343 1445 1289 2465 15322 19171 91 39
201 120D 120U 120C 210 300
[1,] 114868 202 376 558 6422 18671
The transitivity for igraph and statnet data sets were pretty close.
[1] "BGR" "BOS" "ANC" "JFK" "LAS"
first_five_transivity <- transitivity(network_igraph, type = "local", vids = V(network_igraph)[first_five_names])
cbind(first_five_names,first_five_transivity)
first_five_names first_five_transivity
[1,] "BGR" "0.581818181818182"
[2,] "BOS" "0.35292389068469"
[3,] "ANC" "0.0824960338445267"
[4,] "JFK" "0.385964912280702"
[5,] "LAS" "0.223852116875373"
transitivity(network_igraph, type = "global")
[1] 0.3384609
transitivity(network_igraph, type = "average")
[1] 0.6452844
LA seems to have low transivity while BGR has the highest at .58.
distances(network_igraph, "BGR","BOS")
BOS
BGR 1
distances(network_igraph,"BOS", "ANC")
ANC
BOS 2
average.path.length(network_igraph)
[1] 3.52743
average.path.length(network_igraph, directed = F)
[1] 3.447169
names(igraph::components(network_igraph))
[1] "membership" "csize" "no"
components(network_igraph)$no
[1] 6
components(network_igraph)$csize
[1] 745 2 2 3 2 1
components(network_igraph)$membership %>% head()
BGR BOS ANC JFK LAS MIA
1 1 1 1 1 1
#Isolates
isolates(network_statnet)
[1] 166
[1] "DET"
Detroit seems to be the only isolate.
For attribution, please cite this work as
Sullivan (2022, Feb. 12). Project List: HW 1 Network Analysis. Retrieved from https://pjsulliv34.github.io/Blog/posts/hw-1-network-analysis/
BibTeX citation
@misc{sullivan2022hw, author = {Sullivan, Peter}, title = {Project List: HW 1 Network Analysis}, url = {https://pjsulliv34.github.io/Blog/posts/hw-1-network-analysis/}, year = {2022} }