network_visualization.Rmd
This vignette derives the node sizes and matrices required for re-creating network visualization using Gephi.
library(wateReview)
theme_adjacency_matrix <- readRDS(system.file("extdata", "rawTopicNetwork_theme.Rds", package = "wateReview")) NSF_general_adjacency_matrix <- readRDS(system.file("extdata", "rawTopicNetwork_NSF_general.Rds", package = "wateReview")) NSF_specific_adjacency_matrix <- readRDS(system.file("extdata", "rawTopicNetwork_NSF_specific.Rds", package = "wateReview")) country_adjacency_matrix <- readRDS(system.file("extdata", "countryNetwork.Rds", package = "wateReview"))
We normalize all the adjacency matrices with normalize_adj_matrix()
.
normalized_theme_adjacency_matrix <- normalize_adj_matrix(theme_adjacency_matrix) normalized_NSF_general_adjacency_matrix <- normalize_adj_matrix(NSF_general_adjacency_matrix) normalized_NSF_specific_adjacency_matrix <- normalize_adj_matrix(NSF_specific_adjacency_matrix) normalized_country_adjacency_matrix <- normalize_adj_matrix(country_adjacency_matrix) head(normalized_country_adjacency_matrix)
## Argentina Bahamas Barbados Belize Bolivia Brazil
## Argentina 0.1302732 0.001445026 0.0008592782 0.002102218 0.02658057 0.4342906
## Bahamas 0.1483207 0.001199109 0.0007767881 0.001822636 0.02084228 0.4516641
## Barbados 0.1034021 0.002430017 0.0009606103 0.007551300 0.02550304 0.4381585
## Belize 0.0524299 0.001050149 0.0027182269 0.002197684 0.02100569 0.4934910
## Bolivia 0.1350169 0.001338514 0.0015166272 0.003966360 0.03289035 0.3989596
## Brazil 0.1312267 0.001310612 0.0012287026 0.003614844 0.02420086 0.4281945
## Chile Colombia Costa Rica Cuba Ecuador El Salvador
## Argentina 0.09344801 0.02858868 0.01191675 0.001253139 0.02663868 0.0011519057
## Bahamas 0.09575766 0.02419937 0.01480849 0.001020435 0.01739036 0.0007458737
## Barbados 0.09309762 0.01849105 0.03064020 0.001531683 0.01412455 0.0011153667
## Belize 0.08472015 0.04825538 0.01552663 0.001141184 0.03104777 0.0011492557
## Bolivia 0.08514271 0.03440256 0.01784179 0.001612320 0.03173827 0.0015849378
## Brazil 0.09444330 0.02436211 0.01678459 0.001884901 0.02552250 0.0012165491
## Guatemala Haiti Honduras Jamaica Mexico
## Argentina 0.001319755 0.001398669 0.0008305550 0.0008290198 0.1603060
## Bahamas 0.001317527 0.001148808 0.0008999214 0.0007812418 0.1468509
## Barbados 0.001791686 0.002052935 0.0013663397 0.0010325393 0.1847940
## Belize 0.001681508 0.001153688 0.0027114125 0.0009749917 0.1749403
## Bolivia 0.001563140 0.001948138 0.0024029734 0.0011678678 0.1754862
## Brazil 0.001710510 0.001484688 0.0011730553 0.0009265040 0.1721379
## Nicaragua Panama Paraguay Peru Uruguay Venezuela
## Argentina 0.001333872 0.009560359 0.004308403 0.02935763 0.012775164 0.01943242
## Bahamas 0.001160073 0.008772072 0.004394813 0.02715614 0.012854336 0.01611632
## Barbados 0.001611708 0.015949556 0.004473610 0.02439545 0.012397634 0.01312844
## Belize 0.001651274 0.016858022 0.006548925 0.02197102 0.006426464 0.01034945
## Bolivia 0.001653510 0.012952841 0.002871837 0.02386629 0.011178114 0.01889824
## Brazil 0.001417642 0.007954627 0.003910582 0.02608461 0.015558975 0.01365083
We now derive the node size with colSums
.
theme_node_size <- colSums(normalized_theme_adjacency_matrix) NSF_general_node_size <- colSums(normalized_NSF_general_adjacency_matrix) NSF_specific_node_size <- colSums(normalized_NSF_specific_adjacency_matrix) country_node_size <- colSums(normalized_country_adjacency_matrix) head(country_node_size)
## Argentina Bahamas Barbados Belize Bolivia Brazil
## 2.87959494 0.03873448 0.02864630 0.08192841 0.52242468 10.03557501