Computational Social Science, Lecture 05: Networks, Part I

2,005 views

Published on

Published in: Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
2,005
On SlideShare
0
From Embeds
0
Number of Embeds
1,444
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Computational Social Science, Lecture 05: Networks, Part I

  1. 1. Networks Part I Sharad Goel Columbia UniversityComputational Social Science: Lecture 5 February 22, 2013
  2. 2. High School Dating Network[ Bearman, Moody, & Stovel, 2004 ]Image by Mark Newman, via Easley & Kleinberg
  3. 3. Corporate E-mail Communication[ Adamic & Adar, 2004 ]via Easley & Kleinberg
  4. 4. “Internet map 2004” from Math Insighthttp://mathinsight.org/image/internet_map_jurvetson_2004
  5. 5. Networks/Graphs Nodes/verticespeople, organizations, webpages, computers Edgesrepresent connections between pairs of nodes
  6. 6. 2 5 11 14 9 6 2
  7. 7. 1 2 4 6 42 1 2 3 7 13
  8. 8. 31 2 5 4 1 2 3 4 5 6 7 7 1 0 1 0 1 0 0 0 6 2 1 0 1 0 1 0 0 3 0 1 0 0 1 0 0 4 1 0 0 0 1 0 0 5 0 1 1 1 0 1 1 6 0 0 0 0 1 0 0 7 0 0 0 0 1 0 0
  9. 9. 31 2 5 4 7 1 {2, 4} 6 2 {1, 3, 5} 3 {2, 5} 4 {1, 5} 5 {2, 3, 4, 6, 7} 6 {5} 7 {5}
  10. 10. 31 2 5 4 (1, 2) 7 (1, 4) 6 (2, 3) (2, 5) (3, 5) (4, 5) (5, 6) (5, 7)
  11. 11. 2 5 31 2 11 14 9 5 4 2 6 7 6 1 {2:2, 4:4} 2 {1:2, 3:5, 5:11} 3 {2:5, 5:1} 4 {1:4, 5:9} 5 {2:11, 3:1, 4:9, 6:6, 7:2} 6 {5:6} 7 {5:2}
  12. 12. 2 5 31 2 11 14 9 5 4 2 6 (1, 2, 2) 7 (1, 4, 4) 6 (2, 3, 5) (2, 5, 11) (3, 5, 1) (4, 5, 9) (5, 6, 6) (5, 7, 2)
  13. 13. Adjacency list  edge list(weighted) directed network Input Adjacency list Output Edge list
  14. 14. Adjacency list  edge list(weighted) directed network Map input: u {w1, …, wk} foreach wi: output (u, wi) Reduce pass
  15. 15. Edge list  adjacency list(weighted) undirected network Input Edge list Output Adjacency list
  16. 16. Edge list  adjacency list(weighted) undirected network Map input: (u, w) output: (u, w), key := u output: (w, u), key := w Reduce input: u, {w1, …, wk} identity
  17. 17. 31 2 5 4 7 6 Degree of node u # of edges incident on u
  18. 18. Edge list  node degrees undirected network Input Edge list Output Node degrees
  19. 19. Edge list  node degrees undirected network Map input: (u, w) output: (u, w), key := u output: (w, u), key := w Reduce input: u, {w1, …, wk} output: u, k
  20. 20. Edge list  degree distribution undirected network Input Edge list Output Degree distribution
  21. 21. Edge list  degree distribution undirected network Map input: (u, w) output: (u, w), key := u output: (w, u), key := w Reduce input: u, {w1, …, wk} output: u, k
  22. 22. Edge list  degree distribution undirected network Map input: u, k identity, key := k Reduce input: k, {u1, …, um} output: k, m
  23. 23. 31 2 5 4 7 6 Path Sequence of nodes with each consecutive pair connected by an edge
  24. 24. 31 2 5 4 7 6 Cycle Path with at least three edges with first and last nodes the same and all other nodes distinct
  25. 25. Connected GraphThere is a path between every pair of nodes
  26. 26. Connected GraphThere is a path between every pair of nodes
  27. 27. Connected Component A connected subset of nodes that is notcontained in any larger connected subset
  28. 28. DistanceLength of the shortest path between two nodes
  29. 29. DistanceLength of the shortest path between two nodes
  30. 30. Breadth-first Searchiteratively explore nodes one layer at a time
  31. 31. # initialize distancesdist = {}for u in G: dist[u] = NAdist [u1] = 0d=0periphery = { u1 }while len(periphery) > 0: # find nodes one step away from the periphery next_level = {} for u in periphery: next_level += { w for w in neighbors[u] if dist[w] == NA } # update distances d += 1 for u in next_level: dist[u] = d # update periphery periphery = next_level
  32. 32. BFS @ scale undirected network Input edge list, starting node u0 OutputDistance to all nodes from u0
  33. 33. BFS @ scale undirected networkInput: distances (u, d)1. join distances with edge list2. foreach (u, d, w) output (w, d+1) [ also output (u0, 0) ]3. group by w, and output min d

×