connection patterns
play

Connection patterns N E TW OR K AN ALYSIS IN TH E TIDYVE R SE - PowerPoint PPT Presentation

Connection patterns N E TW OR K AN ALYSIS IN TH E TIDYVE R SE Massimo Franceschet Prof . of Data Science , Uni v ersit y of Udine ( Ital y) The adjacenc y matri x ( part 1) as_adjacency_matrix(g) 1 2 3 4 5 6 1 0 1 0


  1. Connection patterns N E TW OR K AN ALYSIS IN TH E TIDYVE R SE Massimo Franceschet Prof . of Data Science , Uni v ersit y of Udine ( Ital y)

  2. The adjacenc y matri x ( part 1) as_adjacency_matrix(g) 1 2 3 4 5 6 1 0 1 0 0 1 0 2 1 0 1 1 0 0 3 0 1 0 1 1 1 4 0 1 1 0 0 0 5 1 0 1 0 0 0 6 0 0 1 0 0 0 NETWORK ANALYSIS IN THE TIDYVERSE

  3. The adjacenc y matri x ( part 2) as_adjacency_matrix(g, attr="weight") 1 2 3 4 5 6 1 0 1 0 0 2 0 2 1 0 2 3 0 0 3 0 2 0 4 5 1 4 0 3 4 0 0 0 5 2 0 5 0 0 0 6 0 0 1 0 0 0 NETWORK ANALYSIS IN THE TIDYVERSE

  4. Working w ith adjacenc y matrices # get the adjacency matrix of network g A = as_adjacency_matrix(g) # get the weighted adjacency matrix of weighted network g A = as_adjacency_matrix(g, attr = "weight") # first row of matrix A A[1, ] # first column of matrix A A[, 1] # diagonal of matrix A diag(A) NETWORK ANALYSIS IN THE TIDYVERSE

  5. Pearson similarit y as_adjacency_matrix(g) [,1] [,2] [,3] [,4] [,5] [,6] [1,] 0 1 0 0 1 0 [2,] 1 0 1 1 0 0 [3,] 0 1 0 1 1 1 [4,] 0 1 1 0 0 0 [5,] 1 0 1 0 0 0 [6,] 0 0 1 0 0 0 NETWORK ANALYSIS IN THE TIDYVERSE

  6. Let ' s tr y some e x amples ! N E TW OR K AN ALYSIS IN TH E TIDYVE R SE

  7. Pearson similarit y N E TW OR K AN ALYSIS IN TH E TIDYVE R SE Massimo Franceschet Prof . of Data Science , Uni v ersit y of Udine ( Ital y)

  8. Vis u ali z ing correlation # scatterplot of degree and strength ggplot(data = nodes, mapping = aes(x = degree, y = strength)) + geom_point() + geom_smooth(method = "lm", se = FALSE) NETWORK ANALYSIS IN THE TIDYVERSE

  9. Comp u ting correlation Positi v e v al u es indicate positi v e correlation Negati v e v al u es indicate negati v e correlation N u ll v al u es indicate no correlation # Pearson correlation coefficient cor(nodes$degree, nodes$strength) 0.9708946 NETWORK ANALYSIS IN THE TIDYVERSE

  10. Let ' s practice ! N E TW OR K AN ALYSIS IN TH E TIDYVE R SE

  11. Most similar and most dissimilar nodes N E TW OR K AN ALYSIS IN TH E TIDYVE R SE Massimo Franceschet Prof . of Data Science , Uni v ersit y of Udine ( Ital y)

  12. NETWORK ANALYSIS IN THE TIDYVERSE

  13. A net w ork as a matri x as_adjacency_matrix(g, attr = "weight") a b c d e a 0 1 0 0 2 b 1 0 2 3 0 c 0 2 0 4 5 d 0 3 4 0 0 e 2 0 5 0 0 NETWORK ANALYSIS IN THE TIDYVERSE

  14. A net w ork as a data frame as_data_frame(g, what = "both") $ties $nodes from to weight name 1 a b 1 a a 2 a e 2 b b 3 b c 2 c c 4 b d 3 d d 5 c d 4 e e 6 c e 5 NETWORK ANALYSIS IN THE TIDYVERSE

  15. Mapping representations # graph to matrix A <- as_adjacency_matrix(g) # matrix to graph g <- graph_from_adjacency_matrix(A) # graph to data frame df = as_data_frame(g, what = "both") # data frame to graph g <- graph_from_data_frame(df$ties, vertices = df$nodes) # matrix to data frame df = as_data_frame(graph_from_adjacency_matrix(A), what = "both") # data frame to matrix A <- as_adjacency_matrix(graph_from_data_frame(df$ties, vertices = df$nodes)) NETWORK ANALYSIS IN THE TIDYVERSE

  16. Let ' s tr y more e x amples ! N E TW OR K AN ALYSIS IN TH E TIDYVE R SE

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend