7.7 PARALLEL GRAPH ALGORITHMS 211take two cycles. The last parallel block takes one comparison to see if the new
node is in the processors set and then N / p updates of closest and dis-
tance. In summary, the main processing loop has 2(N / p) + p + 1 instruc-
tions and is executed N 1 times, giving (N 1) * (2(N / p)+p + 1). This
works out to an O(N^2 / p) run time and a cost of p*O(N^2 / p), or O(N^2 ). As
we saw in the other cases, to achieve optimality, the number of processors
should be about N / lg N.7.7.3
- Give the weighted adjacency matrix for the following four graphs, and cal-
culateA^2 ,A^4 , and A^8.
■7.7.3 EXERCISESA B CF G HD E
4111222 25
4
44422233 3353 66a. b. A BDEFGCA B CF G HD E4541225 24
114213223552 23c. d. A BDEG HCF