library(tidyverse)
library(igraph)
library(visNetwork)
library(DT)
library(plotly)
Sept11_nodes <- read.csv("Sept11_nodes.csv")
Sept11_links <- read.csv("Sept11_links.csv")
terrorist_network <- graph_from_data_frame(Sept11_links,
vertices = Sept11_nodes,
directed = F)
visNetwork(Sept11_nodes, Sept11_links) %>%
visIgraphLayout(layout = "layout_in_circle")
This is a network of the September 11th terrorists.
terrorist_network %>%
edge_density()
[1] 0.07985193
terrorist_network %>%
distances() %>%
as.vector() %>%
as_tibble() %>%
plot_ly(x = ~value) %>%
add_histogram()
This is a histogram showing the distances between the connections the terrorists had with each other.
terrorist_network %>%
get_diameter() %>%
length()
[1] 6
This is the length of the diameter.
terrorist_network %>%
degree()
Samir_Kashk Madjid_Sahoune
1 1
Fahid_al_Shakri Lased_Ben_Heni
1 2
Essid_Sami_Ben_Khemais Seifallah_ben_Hassine
11 2
Mohamed_Bensakhria Mehdi_Khammoun
3 2
Essoussi_Laaroussi Tarek_Maaroufi
2 6
Haydar_Abu_Doha Ahmed_Ressam
3 2
Abu_Qatada Abu_Walid
5 3
Jean-Marc_Grandvisir Abu_Zubeida
1 1
Mizar_Trabelsi Djamal_Beghal
1 8
Kamel_Daoudi Jerome_Courtaillier
3 4
David_Courtaillier Zacarias_Moussaoui
2 7
Imad_Eddin_Barakat_Yarkas Ramzi_Bin_al-Shibh
4 10
Mohammed_Belfas Abdelghani_Mzoudi
2 1
Ahmed_Khalil_Ibrahim_Samir_Al-Ani Mustafa_Ahmed_al-Hisawi
1 4
Agus_Budiman Mounir_El_Motassadeq
5 4
Zakariya_Essabar Mohamed_Atta
5 22
Fayez_Ahmed Mamduh_Mahmud_Salim
8 1
Mamoun_Darkazanli Said_Bahaji
4 8
Ziad_Jarrah Marwan_Al-Shehhi
9 18
Wail_Alshehri Waleed_Alshehri
6 6
Mohand_Alshehri Satam_Suqami
2 8
Abdul_Aziz_Al-Omari Lotfi_Raissi
9 5
Ahmed_Al_Haznawi Raed_Hijazi
4 3
Nabil_al-Marabh Hamza_Alghamdi
4 7
Ahmed_Alghamdi Salem_Alhazmi
5 8
Hani_Hanjour Bandar_Alhazmi
13 2
Rayed_Mohammed_Abdullah Raisal_Al_Salmi
4 2
Majed_Moqed Khalid_Al-Mihdhar
4 6
Nawaf_Alhazmi Osama_Awadallah
11 3
Abdussattar_Shaikh Mohamed_Abdi
3 1
Ahmed_Alnami Saeed_Alghamdi
3 6
This just shows terrorist and their degree.
Sept11_nodes <- Sept11_nodes %>%
mutate(label = name) %>%
mutate(title = name)
Sept11_nodes
This is mutating the label and title into variables.
terrorist_network %>%
edge_betweenness()
[1] 61.000000 61.000000 61.000000 56.500000 4.500000 48.500000
[7] 47.500000 55.833333 48.500000 52.806777 57.500000 441.140110
[13] 12.500000 16.000000 5.166667 12.500000 64.333333 31.859890
[19] 23.666667 63.666667 44.416667 42.750000 46.333333 41.000000
[25] 19.333333 6.250000 61.000000 61.000000 61.000000 31.000000
[31] 9.000000 219.083333 25.250000 4.500000 74.250000 56.500000
[37] 59.815476 373.851190 18.547161 82.979396 40.342857 8.083333
[43] 9.083333 8.833333 36.078571 8.833333 16.816667 31.310256
[49] 20.657143 61.000000 61.000000 46.141617 3.375000 13.583333
[55] 6.849950 47.411905 3.250000 20.911905 34.916667 2.416667
[61] 14.583333 32.750000 2.166667 4.833333 12.416667 73.180506
[67] 83.666667 31.583333 29.580952 37.408283 43.691617 105.793998
[73] 56.587648 51.853968 66.749206 161.377778 251.854401 14.238889
[79] 2.250000 6.474950 43.288889 5.916667 6.552778 61.000000
[85] 6.000000 30.333333 6.000000 11.250000 7.575000 4.583333
[91] 11.167857 16.008333 15.013095 10.516667 24.728280 23.069048
[97] 8.203968 15.098413 48.930628 27.336580 35.373088 5.724950
[103] 3.400000 4.366667 8.891617 11.080253 19.711111 6.581746
[109] 47.742063 43.961111 22.041270 12.907215 16.096898 8.866667
[115] 23.402381 14.160714 24.339683 2.992857 13.387302 12.503968
[121] 10.872222 11.165079 25.895310 12.483333 9.824603 8.622619
[127] 32.086111 8.814286 7.550000 10.350000 15.405700 59.000000
[133] 36.597619 59.000000 27.166667 33.633333 29.945382 2.000000
[139] 2.000000 2.000000 24.283333 23.283333 6.133333 6.133333
[145] 53.866667 53.866667 61.000000 44.350000 41.128571 1.000000
[151] 4.166667
These are the network connections individually and how commonly used and how valuable they are.
Sept11_nodes <- Sept11_nodes %>%
mutate(value = degree(terrorist_network))
Sept11_nodes %>%
arrange(-degree(terrorist_network)) %>%
datatable()
This mutates and sets value to degree.
Sept11_nodes <- Sept11_nodes %>%
mutate(value = degree(terrorist_network))
visNetwork(Sept11_nodes,
Sept11_links,
main = "Network of Terrorists involved in the 9/11 Terrorist Attack") %>%
visIgraphLayout(layout = "layout_nicely") %>%
visOptions(highlightNearest = T, nodesIdSelection = T)
Here is a recreation of the network including bold lines that refects the most valueble direct connection. Each color represents a different group.
Sept11_nodes <- Sept11_nodes %>%
mutate(group = membership(infomap.community(terrorist_network)))
Sept11_nodes %>%
datatable()
This table shows Membership in the terrorist network.
Sept11_links <- Sept11_links %>%
mutate(betweenness = edge_betweenness(terrorist_network)) %>%
mutate(value = betweenness)
Sept11_links
This is just a table to reflect the data of betweeness.
visNetwork(Sept11_nodes,
Sept11_links,
main = "Network of Terrorists involved in the 9/11 Terrorist Attack") %>%
visIgraphLayout(layout = "layout_nicely") %>%
visOptions(highlightNearest = T, nodesIdSelection = T, selectedBy = "group")
This is another recreation of the terrotist network with the option to select by group. each color represents a different group.