430 likes | 539 Views
“IBM Research Report A faster Exponential-Time Algorithm for Max 2-Sat, Max Cut, and Max k-Cut”, Alexander D. Scott, Gregory B. Sorkin, IBM Research Division. Presented By Troy McMahon. Problems Addressed. Max 2-Sat Max Cut Max k-Cut. Background.
E N D
“IBM Research ReportA faster Exponential-Time Algorithm for Max 2-Sat, Max Cut, and Max k-Cut”,Alexander D. Scott, Gregory B. Sorkin, IBM Research Division Presented By Troy McMahon
Problems Addressed • Max 2-Sat • Max Cut • Max k-Cut
Background • The fastest previous algorithm for Max 2-Sat has a runtime of ~O(2m/5), where m is the number of clauses • The fastest previous algorithm for Max Cut has a runtime of ~O(2m/4), where m is the number of edges
Method • This paper considers a single, more general class of problems that includes both Max Cut and 2-Sat.
Notation • D-vertex = “Vertex of degree d” • m and n are the number of vertices and edges in a graph. • [r] = {1,…,r} is the set of colors a vertex can be colored
Max (r, 2)-CSP • An instance consists of a graph G=(E,V), and a set of score functions, and a set of available colors [r]={1,…,r} • For every edge there exists a dyadic function suv(ri,rj) that maps [r]2 -> R • For every vertex there exists a monadic function sv(ri) that maps [r]1 -> R • There is single also a “niladic” score function, so() that maps [r]0 -> R • This function has no effect on the solution to the problem, and exists only for convenient bookkeeping
Max (r, 2)-CSP • A candidate solution, f:V->[r] is a coloring of the vertices (with colorings from [r]) • The score of a coloring is given by the function • The solution to an instance of the Max (r, 2)-CSP problem is the coloring of the graph that maximizes the total score
Max Cut • Max Cut is the partition of a graph into two classes that maximizes the number of edges cut by the petition.
Max Cut • Reduction to (r,2)CSP: • Consider each edge to be a function that is 1 if the vertices it connects are different colors, and 0 otherwise • Max Cut is equivalent to finding a 2-coloring of the vertices that maximizes the sum of all of the edge functions • Max Cut (r,2)CSP
Max 2-Sat • An instance of Max 2-sat consists of a set of 2ary Boolean functions • A solution is a setting of the variables that maximizes the number satisfied functions
Max 2-Sat • Reduction to (r,2)CSP • Max 2-sat can be reduced to (r,2)CSP by creating a vertex for each variable and an edge fore every function • The score of an edge is 1 whenever the corresponding function is satisfied and 0 otherwise • Max 2-sat (r,2)CSP
Algorithm • Reduce vertices of degree 0 • Reduce vertices of degree 1 • Reduce vertices of degree 2 • Branch
Reducing Vertices of Degree 0 • If a vertex, y has no edges then that vertex has no dyadic constraints • Color y the color that maximizes the function for vertex y • Color(y) = maxargCX[r](sy(C) ) • An equivalent problem can be formed by increasing so by max(sy(r) ), and removing y form the graph • This can be done in O(r) time
Reducing Vertices of Degree 1 • Let y be a vertex of degree 1, and x be y’s neighbor • Can be reduced to an equivalent problem by removing vertex y, and edge xy from the graph, and modifying the score functions in the following way • For all CX[r], sx(C)= sx(C)+ maxDX[r]{sxy(CD)+ sy(D)} • This can be done in O(r2) time
Reducing Vertices of Degree 1 • Once an optimal coloring, f‘ is found for the reduced graph, and optimal coloring, f for the original graph can be found in the following manner • f(y)=maxargDX[r]{sxy(f‘(x)D)+ sy(D)} • For all other verities v, f(v)= f‘(v) • This can be done in O(1) time
Reducing Vertices of Degree 2 • Let y be a vertex of degree 2, and x and z be y’s neighbors • Can be reduced to an equivalent problem by removing vertex y, and the edges xy and zy from the graph, and modifying the score functions in the following way • For all C,DX[r], sxz(CD)= sxz(CD)+ maxEX[r]{sxy(CE) + syz(ED)+ sy(E)} • This can be done in O(r3) time
Reducing Vertices of Degree 2 • Once an optimal coloring, f‘ is found for the reduced graph, and optimal coloring, f for the original graph can be found in the following manner • f(y)=maxargEX[r]{sxy(f‘(x)E) + syz(Ef‘(z))+ sy(E)} • For all other verities v, f(v)= f‘(v) • This can be done in O(1) time
Branching • Branching Algorithm • y=highest degree vertex in G • V’=V/y • E’=E-neighbors(y) • For C=every color in [r] • So’=So+Sy(C) • For x=every neighbor of y • Sx(D)’=Sx(D)+Sxy(CD) • fC=recurse on (V’, E’, S’) + {f(y)=C} • f=max(f, fC) • Return f • This algorithm only branches if there are no vertices of degree <3 that it can reduce
Branching • Graphical representation of a reduction on vertex x. • In this case the colors in [r] are red and blue • Vertex x is removed, and 2 new graphs are created (one where the vertex is red and one where it is blue) • The optimal coloring of the original graph is the max of the optimal colorings of the two new graphs.
Recursion Depth • Lemma: If a graph has n vertices and m edges, than the graph is empty after m/5 branches
Recursion Depth • Case 1: If the graph has any vertices of degree P5, then the algorithm will branch on one of these vertices destroying at least 5 edges
Recursion Depth • Graphs containing only vertices of degree 3 and 4
Recursion Depth • Case 2: The highest degree vertex has degree 4. • If the vertex it branches on has at least one neighbor of degree 3 • 4 edges will be destroyed directly • The neighbor of degree 3 will be reduced to degree 2 • This vertex will be reduced at the next level destroying 1 additional edge • If the vertex it branches on has at least 4 neighbor of degree 4 • 4 edges are destroyed • 4 vertices of degree 3 are created • The fact that this algorithm terminates with no vertices of degree 3 is enough to limit the number of such reductions
Recursion Depth • Case 3: The graph contains only vertices of degree 3 • Branching will eliminate 3 edges directly • Removing a vertex will reduce the degree of each of that vertex’s neighbors to 2 • These neighbors will be reduced at the next level without branching • At least 1 edge is destroyed for each of these neighbors • In total at least 6 edges are destroyed
Recursion Depth • Every time the algorithm branches, the number of edges is reduced by at least 5 • The graph will be empty after m/5 branches • The maximum number of times this algorithm can branch is therefore m/5
Space Complexity • This algorithm needs to store the best solution found at each level • The space complexity of this algorithm is therefore O(nd), or O(nm/5),
Time of Algorithm • This algorithm has a branching factor of r • The time for each level is bounded by the function • T(l)= O(2r3n) + rT(l-1) • This algorithm therefore runs in O(r3nrm/5) time
Improved Algorithm • Preference for selecting branching vertices • Vertices of degree >=6 • Vertices of degree 5 that have at least 1 neighbor of degree 3 or 4 • Vertices of degree 5 with only degree 5 neighbors • Vertices of degree 4 that have at least 1 neighbor of degree 3 • Vertices of degree 4 with only degree 4 neighbors • Vertices of Degree 3 • All other aspects of this algorithm are the same as the first algorithm
Reduction Forest • A reduction on a vertex, v, can split component of the graph containing G into multiple subcomponents • Let k(v) be the number of sub-components that a reduction on v will yield • This defines a “reduction forest” • Nodes in the reduction forest correspond to possible vertex reductions • Each node has a child for every sub-component that is created by that node’s corresponding reduction • A node n’s children correspond to the first reductions in
Splitting Tree • Splitting trees can be formed by contracting out all of the nodes that correspond to reductions on vertices of degreeO2 • The depth of a splitting tree is equal to the maximum number of branching reductions that occur along the corresponding sequence • The maximum number of branching reductions is bounded by the maximum splitting tree depth
Depth of Splitting Tree • Lemma: For a graph with m edges, the depth of the splitting tree is at most 2+19m/100
Depth of Splitting Tree • Case 1: If the graph has a vertex of degree P6, then the algorithm branches on this vertex destroying 6 edges • We only need to consider graphs with vertices of degree <6
Depth of Splitting Tree • There are only two types of branching reductions that don’t destroy at least 6 edges • Reductions on vertices of degree 5 that have only degree 5 neighbors • Reductions on verities of degree 4 that have only degree 4 neighbors • The improved algorithm works by limiting the number of occurrences of these types of reductions
Degree 5 Vertices With 5 Degree 5 Neighbors • If a component requires a reduction on a degree 5 vertex with 5 degree 5 neighbors on of 4 things must be true • a. The reduction is the first degree 5 reduction in this branch of the splitting tree • This only occurs once per branch, and contributes at most 1 to the height of the tree • b. The previous reduction produced vertices of degree 3 or 4 that were destroyed • We can pair this reduction with the previous reduction
Degree 5 Vertices With 5 Degree 5 Neighbors • c. The previous reduction was a reduction on a degree 5 vertex that destroyed all 5 of that vertex’s neighbors • Again w can pair this reduction with the previous • The previous reduction was on a degree 5 vertex and produced vertices of degree 3 or 4 that were split off into a different connected component • Produces a non-empty subcomponent, but does not add to the depth of the component of interest • We can construct a similar argument for vertices of degree 4 with 4 neighbors of degree 4
Depth of Splitting Tree • Case 2: Graphs containing only vertices of degree <6.
Depth of Splitting Tree • The dept of a vertex in the splitting tree is at most xm+2 • The +2 comes from the first occurrences of degree 5 and degree 4 vertices • Solve for x • x=19/100 • The depth of the splitting tree is therefore 19m/100+2 • The recursive depth of this algorithm is therefore 19m/100+2
Space Complexity • This algorithm needs to store the best solution found at each level • The space complexity of this algorithm is therefore O(nd), or O((19m/100+1)n)
Time of Algorithm • This algorithm has a branching factor of r • The time for each level is bounded by the function • T(l)= O(2r3n) + rT(l-1) • This algorithm therefore runs in O(r3nr19m/100+2) time
Conclusion • This paper presents 2 algorithms for solving (r,2)-CSP • The first runs in time O(2r3nrm/5) and space O(mn/5) • The second runs in time O(2r3nr19m/100) and space O((19m/100+1)n) • 2-Sat and max cut can be reduced to (r,2)-CSP • 2-Sat and max cut can therefore be solved in time O(2r3nr19m/100) and space O((19m/100+1)n)
References • “IBM Research Report A faster Exponential-Time Algorithm for Max 2-Sat, Max Cut, and Max k-Cut”,Alexander D. Scott, Gregory B. Sorkin, IBM Research Division, IBM Research Division, Thomas J. Watson Research Center, 2004