DOC PREVIEW
Berkeley COMPSCI C267 - Lecture 15 Graph Partitioning - II

This preview shows page 1-2-24-25 out of 25 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 25 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 25 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 25 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 25 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 25 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

CS 267 Applications of Parallel Computers Lecture 15: Graph Partitioning - IIOutline of Graph Partitioning LecturesReview Definition of Graph PartitioningReview of last lecturePartitioning without nodal coordinates - Kernighan/LinKernighan/Lin - Preliminary DefinitionsKernighan/Lin AlgorithmComments on Kernighan/Lin AlgorithmPartitioning without nodal coordinates - Spectral BisectionMotivation for Spectral Bisection: Vibrating StringBasic DefinitionsExample of In(G) and L(G) for 1D and 2D meshesProperties of Incidence and Laplacian matricesSpectral Bisection AlgorithmSlide 15Details for vibrating stringDetails for vibrating string - continuedA “vibrating string” for L(1D mesh)Eigenvectors of L(1D mesh)2nd eigenvector of L(planar mesh)4th eigenvector of L(planar mesh)Motivation for Spectral Bisection: Continuous Approximation to a discrete optimization problemConverting a discrete to a continuous problemComputing v2 and l2 of L(G) using LanczosReferencesCS267 L15 Graph Partitioning II.1Demmel Sp 1999CS 267 Applications of Parallel ComputersLecture 15: Graph Partitioning - IIJames Demmelhttp://www.cs.berkeley.edu/~demmel/cs267_Spr99CS267 L15 Graph Partitioning II.2Demmel Sp 1999Outline of Graph Partitioning Lectures°Review of last lecture°Partitioning without Nodal Coordinates - continued•Kernighan/Lin•Spectral Partitioning°Multilevel Acceleration•BIG IDEA, will appear often in course°Available Software•good sequential and parallel software availble°Comparison of Methods°ApplicationsCS267 L15 Graph Partitioning II.3Demmel Sp 1999Review Definition of Graph Partitioning°Given a graph G = (N, E, WN, WE)•N = nodes (or vertices), E = edges•WN = node weights, WE = edge weights°Ex: N = {tasks}, WN = {task costs}, edge (j,k) in E means task j sends WE(j,k) words to task k°Choose a partition N = N1 U N2 U … U NP such that•The sum of the node weights in each Nj is “about the same”•The sum of all edge weights of edges connecting all different pairs Nj and Nk is minimized°Ex: balance the work load, while minimizing communication°Special case of N = N1 U N2: Graph BisectionCS267 L15 Graph Partitioning II.4Demmel Sp 1999Review of last lecture°Partitioning with nodal coordinates•Rely on graphs having nodes connected (mostly) to “nearest neighbors” in space•Common when graph arises from physical model•Algorithm very efficient, does not depend on edges!•Can be used as good starting guess for subsequent partitioners, which do examine edges•Can do poorly if graph less connected:°Partitioning without nodal coordinates•Depends on edges•No assumptions about where “nearest neighbors” are•Began with Breadth First Search (BFS)CS267 L15 Graph Partitioning II.5Demmel Sp 1999Partitioning without nodal coordinates - Kernighan/Lin°Take a initial partition and iteratively improve it•Kernighan/Lin (1970), cost = O(|N|3) but easy to understand•Fiduccia/Mattheyses (1982), cost = O(|E|), much better, but more complicated°Let G = (N,E,WE) be partitioned as N = A U B, where |A| = |B|°T = cost(A,B) =  {W(e) where e connects nodes in A and B}°Find subsets X of A and Y of B with |X| = |Y| so that swapping X and Y decreases cost:-newA = A - X U Y and newB = B - Y U X-newT = cost(newA , newB) < cost(A,B)-Keep choosing X and Y until cost no longer decreases°Need to compute newT efficiently for many possible X and Y, choose smallestCS267 L15 Graph Partitioning II.6Demmel Sp 1999Kernighan/Lin - Preliminary Definitions°T = cost(A, B), newT = cost(newA, newB)°Need an efficient formula for newT; will use•E(a) = external cost of a in A = {W(a,b) for b in B}•I(a) = internal cost of a in A =  {W(a,a’) for other a’ in A}•D(a) = cost of a in A = E(a) - I(a)-Moving a from A to B would decrease T by D(a)•E(b), I(b) and D(b) defined analogously for b in B°Consider swapping X = {a} and Y = {b}•newA = A - {a} U {b}, newB = B - {b} U {a}°newT = T - ( D(a) + D(b) - 2*w(a,b) ) = T - gain(a,b)•gain(a,b) measures improvement gotten by swapping a and b°Update formulas, after a and b are swapped•newD(a’) = D(a’) + 2*w(a’,a) - 2*w(a’,b) for a’ in A, a’ != a•newD(b’) = D(b’) + 2*w(b’,b) - 2*w(b’,a) for b’ in B, b’ != bCS267 L15 Graph Partitioning II.7Demmel Sp 1999Kernighan/Lin Algorithm Compute T = cost(A,B) for initial A, B … cost = O(|N|2) Repeat … One pass greedily computes |N|/2 possible X,Y to swap, picks best Compute costs D(n) for all n in N … cost = O(|N|2) Unmark all nodes in N … cost = O(|N|) While there are unmarked nodes … |N|/2 iterations Find an unmarked pair (a,b) maximizing gain(a,b) … cost = O(|N|2) Mark a and b (but do not swap them) … cost = O(1) Update D(n) for all unmarked n, as though a and b had been swapped … cost = O(|N|) Endwhile … At this point we have computed a sequence of pairs … (a1,b1), … , (ak,bk) and gains gain(1),…., gain(k) … where k = |N|/2, numbered in the order in which we marked them Pick m maximizing Gain = k=1 to m gain(k) … cost = O(|N|) … Gain is reduction in cost from swapping (a1,b1) through (am,bm) If Gain > 0 then … it is worth swapping Update newA = A - { a1,…,am } U { b1,…,bm } … cost = O(|N|) Update newB = B - { b1,…,bm } U { a1,…,am } … cost = O(|N|) Update T = T - Gain … cost = O(1) endif Until Gain <= 0CS267 L15 Graph Partitioning II.8Demmel Sp 1999 Comments on Kernighan/Lin Algorithm°Most expensive line show in red°Some gain(k) may be negative, but if later gains are large, then final Gain may be positive•can escape “local minima” where switching no pair helps°How many times do we Repeat?•K/L tested on very small graphs (|N|<=360) and got convergence after 2-4 sweeps•For random graphs (of theoretical interest) the probability of convergence in one step appears to drop like 2-|N|/30CS267 L15 Graph Partitioning II.9Demmel Sp 1999Partitioning without nodal coordinates - Spectral


View Full Document

Berkeley COMPSCI C267 - Lecture 15 Graph Partitioning - II

Documents in this Course
Lecture 4

Lecture 4

52 pages

Split-C

Split-C

5 pages

Lecture 5

Lecture 5

40 pages

Load more
Download Lecture 15 Graph Partitioning - II
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lecture 15 Graph Partitioning - II and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lecture 15 Graph Partitioning - II 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?