parallel algorithm course 09
parallel algorithm
note
parallel alg
array
linked list
tree (to list)
graph (today)
parallel BFS
(G[V,E],S)
BFS
[V] = inf
D[S] = 0
D
= {s}
F
while F not empty do {
= pop(F)
v for (v, w) in E do {
if D[w] = inf {
[w] = D[v] + 1
D(F, w)
push}
}
}
key idea: layering \(F_l\)
need a data structure:
allow repetitive occurance of elements
unordered
fast search union and split
Bag of pennats
A pennant: \(2^k\) nodes
add an extra root to a balance binary tree
union, split
a bag of pennants can be mapped to a binary number
insert -> add one (\(O(\log n)\))
combine two bags of pennants -> binary number adding (\(O(\log n)\))
split -> require balance (\(O(\log n)\))
// calculate F(l+1) given F(l)
initialize(F(l+1), an empty pennant)
process-level (G, F(l), F(l+1), D)
fun if |F(l)| > threshold {
, Fb = split(F(l))
Fa
spam {process-level (G, Fa, F(l+1), D)
process-level (G, Fb, F(l+1), D)
}
syncelse {
} in F(l)
foreach v -for (v, w) in E do {
parif D[w] = inf {
= D[v] + 1
D[w] insert(F(l+1), w)
}
} }
extend
matrix A, B, C
\(A\times B=C\)
tile
consider \(A^k\)
save \(A\), \(A^T\)