34
Prob Set 5: due Wed eve 11 Apr 2018 Info 2950, Lecture 17 29 Mar 2018

Info 2950, Lecture 17 - Cornell University

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Info 2950, Lecture 17 - Cornell University

Prob Set 5: due Wed eve 11 Apr 2018

Info 2950, Lecture 17 29 Mar 2018

Page 2: Info 2950, Lecture 17 - Cornell University

https://en.wikipedia.org/wiki/Zachary's_karate_club

“A social network of a karate club was studied by Wayne W. Zachary for a period of three years from 1970 to 1972. The network captures 34 members of a karate club, documenting 78 pairwise links between members who interacted outside the club. During the study a conflict arose between the administrator and instructor , which led to the split of the club into two. Half of the members formed a new club around the instructor, members from the other part found a new instructor or gave up karate. Based on collected data Zachary assigned correctly all but one member of the club to the groups actually joined after the split.”

Page 3: Info 2950, Lecture 17 - Cornell University

https://en.wikipedia.org/wiki/Zachary's_karate_club

“A social network of a karate club was studied by Wayne W. Zachary for a period of three years from 1970 to 1972. The network captures 34 members of a karate club, documenting 78 pairwise links between members who interacted outside the club. During the study a conflict arose between the administrator and instructor , which led to the split of the club into two. Half of the members formed a new club around the instructor, members from the other part found a new instructor or gave up karate. Based on collected data Zachary assigned correctly all but one member of the club to the groups actually joined after the split.”

[34] [1]

34

1

Page 4: Info 2950, Lecture 17 - Cornell University

https://en.wikipedia.org/wiki/Zachary's_karate_club

“A social network of a karate club was studied by Wayne W. Zachary for a period of three years from 1970 to 1972. The network captures 34 members of a karate club, documenting 78 pairwise links between members who interacted outside the club. During the study a conflict arose between the club president [34] and instructor [1], which led to the split of the club into two. Half of the members formed a new club around the instructor, members from the other part found a new instructor or gave up karate. Based on collected data Zachary assigned correctly all but one member of the club to the groups actually joined after the split.”

Easley/Kleinberg fig 3.13:Could the boundaries of the two subclubs be predicted from the network structure?

Page 5: Info 2950, Lecture 17 - Cornell University

4933

121

Easley/Kleinberg fig 3.14a

use “Edge betweenness”= # shortest length paths through edgeas splitting criterion

Page 6: Info 2950, Lecture 17 - Cornell University

1

Easley/Kleinberg fig 3.14a

use “Edge betweenness”= # shortest length paths through edgeas splitting criterion

12

5

Page 7: Info 2950, Lecture 17 - Cornell University

1

Easley/Kleinberg fig 3.14a

use “Edge betweenness”= # shortest length paths through edgeas splitting criterion

12

5

Page 8: Info 2950, Lecture 17 - Cornell University

1

Easley/Kleinberg fig 3.14a

use “Edge betweenness”= # shortest length paths through edgeas splitting criterion

12

5

Page 9: Info 2950, Lecture 17 - Cornell University

x

Page 10: Info 2950, Lecture 17 - Cornell University

Easley/Kleinberg p.78

Which are the important vertices?Which are the important edges?

Which play a central rolein mediating communication?

Use edge betweenness and vertex betweenness:

those with the mostshortest length paths going through themmay be most “central” to the network.

Page 11: Info 2950, Lecture 17 - Cornell University

Easley/Kleinberg p.78 To consider centrality for paths starting from A,rearrange to put A at the top (will have to repeatfor each of the nodes, so an O(N2) algorithm)

A

A

Page 12: Info 2950, Lecture 17 - Cornell University

First count the number ofshortest length paths from Ato every other vertex,level by levelstarting from the top

Page 13: Info 2950, Lecture 17 - Cornell University

First count the number ofshortest length paths from Ato every other vertex,level by levelstarting from the top

Page 14: Info 2950, Lecture 17 - Cornell University

3 3

22

6

1

1 111

Then count the number ofshortest length paths emanatingfrom A through each edge,level by level starting from the bottom

(Number of shortestlength paths from Ato each other vertexnow labelled in blue)

Page 15: Info 2950, Lecture 17 - Cornell University

3 3

22

6

1

1 111

Then count the number ofshortest length paths emanatingfrom A through each edge,level by level starting from the bottom

(Number of shortestlength paths from Ato each other vertexnow labelled in blue)

(The total number ofshortest length pathsfrom A is 10, i.e., thenumber of other vertices)

Page 16: Info 2950, Lecture 17 - Cornell University

(from Rosen,10.6)

Page 17: Info 2950, Lecture 17 - Cornell University

A weighted graph is a graph such that each edge ehas an associated real number w(e) called the weight of the edge.

Given a graph with weights on each of its edges,we want to determine a spanning tree with the smallest total weight

This is called a minimal spanning tree.

The total weight of a tree (or any graph) is the sum of the weights of its edges.

Here we consider a greedy algorithm, Kruskal’s Algorithm,to find the minimal spanning tree.

Page 18: Info 2950, Lecture 17 - Cornell University

Kruskal’s AlgorithmFind minimal spanning tree

Initialize T = (V, E):V = {vertices of G}E = {}

1. Take an edge e ∈ G such that w(e) is minimal If E ∪ e is a forest, add e to E2. Remove e from G.3. If |T| == n − 1: stop else: go to step 1 Prim’s algorithm: 1. -> If E ∪ e is a tree, …

[i.e., keep it connected all stages, edgesadded in different order but same final result] try it

Page 19: Info 2950, Lecture 17 - Cornell University

Kruskal’s AlgorithmFind minimal spanning tree

Initialize T = (V, E):V = {vertices of G}E = {}

1. Take an edge e ∈ G such that w(e) is minimal If E ∪ e is a forest, add e to E2. Remove e from G.3. If |T| == n − 1: stop else: go to step 1 Prim’s algorithm: 1. -> If E ∪ e is a tree, …

[i.e., keep it connected all stages, edgesadded in different order but same final result] try it

Page 20: Info 2950, Lecture 17 - Cornell University

Kruskal’s AlgorithmFind minimal spanning tree

Initialize T = (V, E):V = {vertices of G}E = {}

1. Take an edge e ∈ G such that w(e) is minimal If E ∪ e is a forest, add e to E2. Remove e from G.3. If |T| == n − 1: stop else: go to step 1 Prim’s algorithm: 1. -> If E ∪ e is a tree, …

[i.e., keep it connected all stages, edgesadded in different order but same final result] try it

Page 21: Info 2950, Lecture 17 - Cornell University

Kruskal’s AlgorithmFind minimal spanning tree

Initialize T = (V, E):V = {vertices of G}E = {}

1. Take an edge e ∈ G such that w(e) is minimal If E ∪ e is a forest, add e to E2. Remove e from G.3. If |T| == n − 1: stop else: go to step 1 Prim’s algorithm: 1. -> If E ∪ e is a tree, …

[i.e., keep it connected all stages, edgesadded in different order but same final result] try it

Page 22: Info 2950, Lecture 17 - Cornell University

Kruskal’s AlgorithmFind minimal spanning tree

Initialize T = (V, E):V = {vertices of G}E = {}

1. Take an edge e ∈ G such that w(e) is minimal If E ∪ e is a forest, add e to E2. Remove e from G.3. If |T| == n − 1: stop else: go to step 1 Prim’s algorithm: 1. -> If E ∪ e is a tree, …

[i.e., keep it connected all stages, edgesadded in different order but same final result] try it

Page 23: Info 2950, Lecture 17 - Cornell University

Kruskal’s AlgorithmFind minimal spanning tree

Initialize T = (V, E):V = {vertices of G}E = {}

1. Take an edge e ∈ G such that w(e) is minimal If E ∪ e is a forest, add e to E2. Remove e from G.3. If |T| == n − 1: stop else: go to step 1 Prim’s algorithm: 1. -> If E ∪ e is a tree, …

[i.e., keep it connected all stages, edgesadded in different order but same final result] try it

Page 24: Info 2950, Lecture 17 - Cornell University

maps.google.com

Page 25: Info 2950, Lecture 17 - Cornell University

Shortest Path Algorithm

Greedy algorithm due to Dijkstra (1959)

shortest path from a to z?

start from vertex a, -> find nearest vertex.then look at paths through thosetwo with one additional edge, -> find second nearest vertex to a.then look at paths through thosethree with one additional edge, -> find third nearest vertex to a

and so on, until reach zRosen 10.6 fig.3 p.710

Page 26: Info 2950, Lecture 17 - Cornell University
Page 27: Info 2950, Lecture 17 - Cornell University

Start from {a}, two paths: (a,b), (a,d)

Page 28: Info 2950, Lecture 17 - Cornell University

Start from {a}, two paths: (a,b), (a,d)(a,d) is shortest

distance (a,d) = 2

Page 29: Info 2950, Lecture 17 - Cornell University

From {a,d}, two paths: (a,b), (a,d,e)

Start from {a}, two paths: (a,b), (a,d)(a,d) is shortest

distance (a,d) = 2

Page 30: Info 2950, Lecture 17 - Cornell University

From {a,d}, two paths: (a,b), (a,d,e)

Start from {a}, two paths: (a,b), (a,d)(a,d) is shortest

distance (a,d) = 2distance (a,b) = 4

(a,b) is shortest

Page 31: Info 2950, Lecture 17 - Cornell University

From {a,d}, two paths: (a,b), (a,d,e)

From {a,b,d}, three paths: (a,b,c), (a,b,e), (a,d,e)

Start from {a}, two paths: (a,b), (a,d)(a,d) is shortest

distance (a,d) = 2distance (a,b) = 4

(a,b) is shortest

Page 32: Info 2950, Lecture 17 - Cornell University

From {a,d}, two paths: (a,b), (a,d,e)

From {a,b,d}, three paths: (a,b,c), (a,b,e), (a,d,e)

Start from {a}, two paths: (a,b), (a,d)

distance (a,e) = 5

(a,d,e) is shortest

(a,d) is shortest

distance (a,d) = 2distance (a,b) = 4

(a,b) is shortest

Page 33: Info 2950, Lecture 17 - Cornell University

From {a,d}, two paths: (a,b), (a,d,e)

From {a,b,d}, three paths: (a,b,c), (a,b,e), (a,d,e)

From {a,b,d,e}, two paths: (a,b,c), (a,d,e,z)

Start from {a}, two paths: (a,b), (a,d)

distance (a,e) = 5

(a,d,e) is shortest

(a,d) is shortest

distance (a,d) = 2distance (a,b) = 4

(a,b) is shortest

Page 34: Info 2950, Lecture 17 - Cornell University

From {a,d}, two paths: (a,b), (a,d,e)

From {a,b,d}, three paths: (a,b,c), (a,b,e), (a,d,e)

From {a,b,d,e}, two paths: (a,b,c), (a,d,e,z)

Start from {a}, two paths: (a,b), (a,d)

(a,d,e,z) is shortestdistance (a,z) = 6distance (a,e) = 5

(a,d,e) is shortest

(a,d) is shortest

distance (a,d) = 2distance (a,b) = 4

(a,b) is shortest