

























Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


























2
—Prim's algorithm
—Dijkstra's Algorithm
4
5
—every pair of vertices is connected by a path.
—adjacency matrix
—adjacency list
7
—each list Adj[v] is a list of all vertices adjacent to v
Undirected graph
Adjacency list
representation
8
—subgraph of G that is a tree containing all the vertices of G
—if graph is not connected: spanning forest
— sum of the weights of the edges in the subgraph
—spanning tree with minimum weight
10
// initialize spanning tree vertices V
T
with vertex r, the designated root
// compute d[:], the
// weight between
// r and each
// vertex outside V
T
// use d[:] to find u,
// vertex closest to T
// add u to T
// recompute d[:] now
// that u is in T
// while there are vertices outside T
11
Minimum Spanning Tree: Prim's Algorithm
3 iterations of Prim’s algorithm
start with arbitrary root
13
distance array
adjacency matrix
partition d and A among p processes
—each process first identifies the locally closest node
—perform a global reduction to select globally closest node
—leader inserts node into MST
—broadcasts choice to all processes
—each process updates its part of d vector locally based on choice
14
16
17
find the shortest paths from vertex v ∈ V to all other vertices in V
—maintains a set of nodes for which the shortest paths are known
—grows set by adding node closest to source using one of the
nodes in the current shortest path set
19
—data partitioning
—in each step,
use a MINLOC reduction, after which everyone knows (u, L[u])
— identical to that of Prim's algorithm
2
/p + n log p)
20
— find the shortest paths between all pairs of vertices v
i
, v
j