大规模数据处理 / 云计算 Lecture 8 – Graph Algorithm. 彭波 北京大学信息科学技术学院 7 /28/2011 http://net.pku.edu.cn/~course/cs402/. Jimmy Lin University of Maryland. 课程建设. SEWM Group.
Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.
大规模数据处理/云计算Lecture 8 – Graph Algorithm
彭波
北京大学信息科学技术学院
7/28/2011
http://net.pku.edu.cn/~course/cs402/
Jimmy Lin
University of Maryland
课程建设
SEWMGroup
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United StatesSee http://creativecommons.org/licenses/by-nc-sa/3.0/us/ for details
Graph problems and representations
Parallel breadth-first search
PageRank
Source: Wikipedia (Königsberg)
Represent a graph as an n x n square matrix M
2
1
3
4
1: 2, 4
2: 1, 3, 4
3: 1
4: 1, 3
Take adjacency matrices… and throw away all the zeros
1
10
0
9
2
3
4
6
7
5
2
Example from CLR
10
1
10
0
9
2
3
4
6
7
5
5
2
Example from CLR
8
14
1
10
0
9
2
3
4
6
7
5
5
7
2
Example from CLR
8
13
1
10
0
9
2
3
4
6
7
5
5
7
2
Example from CLR
8
9
1
1
10
0
9
2
3
4
6
7
5
5
7
2
Example from CLR
8
9
1
10
0
9
2
3
4
6
7
5
5
7
2
Example from CLR
d1
m1
…
d2
s
n
…
m2
…
d3
Source: Wikipedia (Wave)
n7
n0
n1
n2
n3
n6
n5
n4
n8
n9
Not true!
How many iterations are needed in parallel BFS (positive edge weight case)?
Convince yourself: when a node is first “discovered”, we’ve found the shortest path
1
search frontier
1
1
n6
n7
n8
10
r
n9
1
n5
n1
1
1
s
q
p
n4
1
1
n2
n3
How many iterations are needed in parallel BFS (positive edge weight case)?
Practicalities of implementation in MapReduce
Given page x with inlinkst1…tn, where
t1
X
t2
…
tn
Iteration 1
n2 (0.2)
n2 (0.166)
0.1
n1 (0.2)
0.1
0.1
n1 (0.066)
0.1
0.066
0.066
0.066
n5 (0.2)
n5 (0.3)
n3 (0.2)
n3 (0.166)
0.2
0.2
n4 (0.2)
n4 (0.3)
Iteration 2
n2 (0.166)
n2 (0.133)
0.033
0.083
n1 (0.066)
0.083
n1 (0.1)
0.033
0.1
0.1
0.1
n5 (0.3)
n5 (0.383)
n3 (0.166)
n3 (0.183)
0.3
0.166
n4 (0.3)
n4 (0.2)
Map
n2
n4
n3
n5
n4
n5
n1
n2
n3
n1
n2
n2
n3
n3
n4
n4
n5
n5
Reduce
Sparse vs. dense graphs
Graph topologies