Graph partitioning using matrix differential equations

Given a connected undirected weighted graph, we are concerned with problems related to partitioning the graph. First of all we look for the closest disconnected graph (the minimum cut problem), here with respect to the Euclidean norm. We are interested in the case of constrained minimum cut problems, where constraints include cardinality or membership requirements, which leads to NP-hard combinatorial optimization problems. Furthermore, we are interested in ambiguity issues, that is in the robustness of clustering algorithms that are based on Fiedler spectral partitioning. The above-mentioned problems are restated as matrix nearness problems for the weight matrix of the graph. A key element in the solution of these matrix nearness problems is the use of a constrained gradient system of matrix differential equations.

1. Introduction. In this paper we present a novel approach to partitioning a connected weighted undirected graph. We consider the Frobenius-norm minimum cut problem and allow for constraints such as prescribing the minimum cardinality of connected components or assigning a priori selected vertices to a component. We use spectral graph theory as pioneered by Fiedler [6], see also the monograph by Chung [3] and the introductory articles [16,18]. We formulate and use a gradient system of matrix differential equations to drive the smallest nonzero eigenvalue of the graph Laplacian to zero. Once this eigenvalue becomes zero, the graph is disconnected and the corresponding eigenvector indicates the membership of vertices to the connected components. This approach can be extended to other partitioning problems beyond the constrained minimum cut problems considered here.
The approach of this paper takes basic ideas and techniques of recent algorithms for eigenvalue optimization via differential equations, as given for example in [9,8,11,10], to another application area. A common feature is a two-level procedure, where on the inner level a gradient flow drives perturbations to the original matrix of a fixed size into a (local) minimum of a functional that depends on eigenvalues and possibly eigenvectors, and in an outer iteration the perturbation size is determined such that the functional becomes zero. As with the previous algorithms cited above, the algorithms presented here cannot guarantee to find the global minimum of a non-smooth, non-convex optimization problem, or of an NP-hard combinatorial optimization problem. There are cases where our algorithm could get stuck in a local minimum, and we will present a contrived example where this happens. Even with this caveat, the presented algorithm performs remarkably well in the examples from the literature on which we have tested it.
As opposed to combinatorial algorithms, the algorithm presented here modifies all weights of the graph as it proceeds, and only in the end arrives at the cut and the unchanged remaining weights.
The proposed algorithm is an iterative algorithm, where in each step the second eigenvalue and the associated eigenvector of the Laplacian of a graph with perturbed weights are computed.
In the cardinality-or membership-constrained cases, additionally a linear system with an extended shifted Laplacian is solved in each step. For a large sparse connected graph (where the number of edges leaving any vertex is moderately bounded), these computations can be done in a complexity that is linear in the number of vertices. In the known (unconstrained) minimum cut algorithms, the computational complexity is at least quadratic [17]. It is thus conceivable that for large sparse connected graphs, the proposed iterative algorithm can favorably compete with the classical unconstrained minimum cut algorithms. In constrained cases, it appears that the computational complexity is even more favorable in comparison with the existing heuristic combinatorial algorithms as proposed in [2]. However, as of now no detailed comparisons of the relative merits of the conceptually and algorithmically fundamentally different approaches have been made.
In Section 2 we formulate the Frobenius-norm minimum cut problem and its cardinalityand membership-constrained variants. This is stated as a matrix nearness problem where it is asked how far, with respect to the Frobenius norm, the weight matrix of the given graph is from that of some disconnected graph which should possibly satisfy additional constraints. We give basic notation and recall Fiedler's theorem on graph connectivity. We also formulate an ambiguity problem where it is asked how far the given weight matrix is from the weight matrix of a graph for which the second and third eigenvalues of the graph Laplacian coalesce and for which therefore graph partitioning based on the Fiedler vector (the eigenvector to the second eigenvalue) becomes ambiguous.
In Section 3 we describe the two-level approach to the unconstrained Frobenius-norm minimum cut problem. This is the central section of the paper, where the basic approach is developed.
In Section 4 we extend the approach to the cardinality-and membership-constrained minimum cut problems, and in Section 5 we extend it to the ambiguity problem.
In Section 6 we describe algorithmic aspects such as the discretization of the norm-and inequality-constrained gradient flow, the choice of initial values, and stopping criteria. In particular, since it is known beforehand that the weights of the cut graph are either zero or those of the original graph, the iteration need not be carried out to full convergence. Section 7 shows numerical results of the proposed algorithm for some graphs taken from the literature.

Preparations and problem formulation.
2.1. The Frobenius-norm minimum cut problem. Consider a graph with vertex set V = {1, . . . , n} and edge set E ⊂ V × V. We assume that the graph is undirected: with (i, j) ∈ E, also (j, i) ∈ E. With the undirected graph we associate weights w ij for (i, j) ∈ E, such that The graph is connected if for all i, j ∈ V, there is a path (i 0 , i 1 ), (i 1 , i 2 ), . . . , (i −1 , i ) ∈ E of arbitrary length , such that i = i 0 and j = i and w i k−1 ,i k > 0 for all k = 1, . . . , .
The problem considered in this paper is the following: Given a connected weighted undirected graph with weights w ij , we aim to find a disconnected weighted undirected graph with the same edge set E and modified weights w ij such that The solution to this matrix nearness problem is the same as that of finding a cut C, i.e., a set of edges that yield a disconnected graph when they are removed from E, where the cut C is such that When the weights are replaced by their square roots, so that w ij instead of w 2 ij appears in the above sum, this becomes the classical minimum cut problem, for which algorithms with complexity O(|V| 2 log |V| + |V| · |E|) exist; see Stoer & Wagner [17] and references therein.

2.2.
Constrained minimum cut problems. The above problem will further be considered with additional constraints. In particular, we consider the following cases: • Membership constraint: It is required that a given set of vertices V + ⊂ V is in one connected component and another given set of vertices V − ⊂ V is in the other connected component. • Cardinality constraint: It is required that each of the connected components has a prescribed minimum number n of vertices. It is known that cardinality constraints make the problem NP-hard 2.3. Graph Laplacian and algebraic connectivity. Setting w ij = 0 for (i, j) / ∈ E, we have the symmetric weight matrix The degrees d i = n j=1 w ij are collected in the diagonal matrix The Laplacian matrix L = Lap(W ) is defined by We note that by the Gershgorin circle theorem, all eigenvalues of L are nonnegative, and L1 = 0, so that λ 1 = 0 is the smallest eigenvalue of L. Remarkably, the connectivity of the graph is characterized by the second-smallest eigenvalue of L. Theorem 2.1 (M. Fiedler [6]). Let W ∈ R n×n be the weight matrix of an undirected graph and L the corresponding Laplacian matrix. Let 0 = λ 1 ≤ λ 2 ≤ . . . ≤ λ n be the eigenvalues of L. Then, the graph is disconnected if and only if λ 2 = 0. Moreover, if 0 = λ 2 < λ 3 , then the entries of the corresponding eigenvector orthogonal to 1 assume only two different values, of different sign, which mark the membership to the two connected components.
Because of this result, the second smallest eigenvalue λ 2 of L is called algebraic connectivity of W . If λ 2 is a simple eigenvalue, then the corresponding eigenvector is known as the Fiedler vector.

2.
4. An ambiguity problem in graph partitioning. Based on Theorem 2.1, a common and computationally inexpensive strategy for partitioning a graph is to compute the Fiedler vector and to partition the graph according to the values of its entries. This becomes unreliable when a small perturbation of the weights yields a coalescence of the eigenvalues λ 2 and λ 3 . It is then interesting to know the distance of the given weight matrix from the set of weight matrices with λ 2 = λ 3 .
3. Two-level method for the Frobenius-norm minimum cut problem.
3.1. Two-level formulation. Our approach can be summarized as follows: 1. Given ε > 0, we look for a symmetric matrix E = (e ij ) ∈ R n×n with the same sparsity pattern as W (i.e., e ij = 0 if w ij = 0), of unit Frobenius norm, with W + εE ≥ 0 (with componentwise inequality) such that the second smallest eigenvalue of Lap(W + εE) is minimal. The obtained minimizer is denoted by E(ε). 2. We look for the smallest value of ε such that the second smallest eigenvalue of Lap(W + εE(ε)) equals 0.
In order to compute E(ε) for a given ε > 0, we make use of a constrained gradient system for the functional F ε (E) = λ 2 Lap(W + εE) , (3.1) under the constraints of unit Frobenius norm and W +εE ≥ 0 and the symmetry and the sparsity pattern of E.
In the outer iteration we compute the optimal ε, denoted ε , by a combined Newton-bisection method.
The algorithm computes a partition of the graph as provided by the Fiedler vector corresponding to the weight matrix W + ε E(ε ). This is not guaranteed to yield a global optimum for the Frobenius-norm minimum cut problem, since the gradient flow might converge only to a local minimum. In any case, it provides an upper bound for the distance problem (2.1).

3.2.
Constrained gradient flow for the functional F ε .
3.2.1. Eigenvalue derivatives. We will use the following standard perturbation result for eigenvalues; see, e.g., [12, Section II.1.1]. Here and in the following, we denote˙= d/dt. Lemma 3.1. Consider the differentiable symmetric n × n matrix valued function C(t) for t in a neighborhood of 0. Let λ(t) be an eigenvalue of C(t) converging to a simple eigenvalue We denote by · = · F the Frobenius norm on R n×n and by X, Y = trace(X T Y ) the corresponding inner product.
We return to the situation of the previous section. For a set of edges E, we define P E as the orthogonal projection from R n×n onto the sparsity pattern determined by E: for A = (a ij ), For a fixed given weight matrix W and for ε > 0, we call a matrix E = (e ij ) ∈ R n×n ε-feasible if the following conditions are satisfied: Consider now a regular path E(t) of ε-feasible matrices, and denote the corresponding Laplacian matrix by L(t) = Lap(W + εE(t)) and by λ 2 (t) the second smallest eigenvalue of L(t). Lemma 3.1 applied to the Laplacian matrix L(t) yields (omitting the argument t) where x(t) is a corresponding eigenvector of unit Euclidean norm. Next we rearrange (3.2) to an equationλ 2 = ε G ε (E),Ė with an appropriate matrix-valued function G ε , which is the gradient of F ε in the space of symmetric matrices with sparsity pattern E. In the following, Sym(A) = 1 2 (A + A T ) denotes the symmetric part of a quadratic matrix A, and we write x 2 = (x 2 i ) ∈ R n for the vector of squares of the entries of x = (x i ) ∈ R n . Lemma 3.2. In the above situation we havė is symmetric and has the sparsity pattern determined by the set of edges E.
Proof. We note thaṫ Combining (3.2) and (3.4), we obtaiṅ The second term is already in the desired form. We obtain for the first term SinceĖ and xx T are symmetric, this can be rewritten aṡ We then haveλ This is in the desired form: G ε (E) is symmetric and has the sparsity pattern E.

Admissible directions.
Since E(t) is of unit Frobenius norm by condition (i), we have Condition (iv) requires thatė ij ≥ 0 for all (i, j) ∈ E 0 , where E 0 = E 0 (εE) is the set of cut edges defined by Conditions (ii) and (iii) are satisfied if the same holds forĖ. These four conditions are in fact also sufficient for a matrix to be the time derivative of a path of ε-feasible matrices. Hence, for every ε-feasible matrix E, a matrix Z = (z ij ) ∈ R n×n is the derivative at t = 0 of some path of ε-feasible matrices starting at E if and only if the following four conditions are satisfied:

Admissible direction of steepest descent.
To determine the admissible directioṅ E of steepest descent from E, we therefore consider the following optimization problem for G = G ε (E): min Z G, Z subject to (i')-(iv') and Z, Z = 1. (3.7) The additional constraint Z = 1 just normalizes the descent direction. Problem (3.7) has a quadratic constraint. We now formulate a quadratic optimization problem with linear constraints, which is equivalent in the sense that it yields the same descent direction, provided that a strict descent direction exists, i.e., satisfying G, Z < 0 and the constraints (i')-(iv'). This is based on the fact that when G, Z < 0, there exists a scaling factor α > 0 such that G, αZ = −1. Consider the following problem: min Z Z, Z subject to (i')-(iv') and G, Z = −1.
In addition, there are conditions (i')-(iv'). It can be shown (see [5, Lemma 3.2.1]) that the symmetry and sparsity conditions (ii') and (iii') need not be imposed, but are consequences of conditions (ii) and (iii) on E and the corresponding properties of G = G ε (E).
3.2.5. Constrained gradient flow. The gradient flow of F ε under the constraints (i)-(iv) is the system of differential equationsĖ where Z(t) solves the KKT system (3.9) with G = G ε (E(t)) under the constraints (i')-(iv') with the set of edges E 0 (t) = E 0 (εE(t)). Lemma 3.3. On an interval where E 0 (t) does not change, the gradient system becomes, with P + = P E\E0 and omitting the ubiquitous argument t, Proof. The positive Lagrange multipliers µ ij > 0 just have the role to ensure thatė ij = 0. With G = G ε (E), the gradient system therefore readṡ where κ is determined from the constraint E,Ė = 0. We then have and the result follows.
In a numerical solution of the gradient system, we thus have to monitor the sets of edges where w ij + εe ij = 0 and among them further those edges where the sign of −g ij − κe ij changes. When the active set is changed, then also κ changes in a discontinuous way. Let κ − and κ + be the values of κ before and after the event of discontinuity, respectively. Then one has generically g ij + κ − e ij > 0 after the event for the critical edge (i, j), but the sign of g ij + κ + e ij may be positive or negative. In the first case, (i, j) leaves E 0 . In the latter case, only a generalized solution in the Filippov sense exists, which keeps (i, j) ∈ E 0 , i.e., w ij + εe ij = 0. This is enforced until g ij + κ + e ij changes sign. From a practical perspective, it appears reasonable just to keep (i, j) ∈ E 0 for all future time once it has entered E 0 , which means that a cut of an edge is made irreversible.
3.2.6. Monotonicity and stationary points. The following monotonicity result follows directly from the construction of the gradient system. Theorem 3.4. Let E(t) of unit Frobenius norm satisfy the differential equation (3.12) with G ε (E) of (3.3). Then, the second smallest eigenvalue λ 2 (t) of the Laplacian matrix Lap(W + εE(t)) decreases monotonically with t:λ 2 (t) ≤ 0.
Equilibrium points of (3.12) are characterized as follows. Theorem 3.5. The following statements are equivalent along solutions of (3.12): . Proof. Using Lemma 3.2 and (3.12) we obtain, with G = G ε (E), With the strong form of the Cauchy-Schwarz inequality, the result follows.
3.3. Newton-bisection outer iteration. Let E(ε) denote the minimizer of the functional F ε . In general we expect that for a given perturbation size ε < ε , the eigenvalue λ 2 (W + εE(ε)) > 0 is simple. If so, then f (ε) = F ε (E(ε)) is a piecewise smooth function of ε and we can exploit its regularity to obtain a fast iterative method to converge to ε from the left. Otherwise we can use a bisection technique to approach ε .
The following result provides an inexpensive formula for the computation of the derivative of f (ε) = F ε (E(ε)), which will be useful in the construction of the outer iteration of the method.
Assumption 3.1. We assume that the second smallest eigenvalue of Lap(W + εE(ε)) is simple. Moreover, E(ε) is assumed to be a smooth function of ε in some interval, and the set of zero-weight edges E 0 related to E(ε) is independent of ε in the interval.
We denote again P + = P E\E0 . We then have the following result. Lemma 3.6. Under Assumption 3.1, the function f (ε) = F ε (E(ε)) is differentiable and its derivative equals (with = d/dε) Proof. Under Assumption 3.1, the projection P + remains constant near ε. This means that we are effectively working on a reduced set E = E \ E 0 of edges. We set G + (ε) = P + G ε (E(ε)) and decompose εE(ε) = εP + E(ε) + R, where R = (I − P + )εE(ε) = −(I − P + )W = −P E0 W, since w ij + εe ij (ε) = 0 for all (i, j) ∈ E 0 . In particular, R is independent of ε. Differentiating f (ε) = F ε E(ε) with respect to ε we obtain f (ε) = G ε (E(ε)), P + E(ε) + εP + E (ε) = G + (ε), P + E(ε) + εP + E (ε) . (3.14) The conservation of E(ε) = 1 and of R for all ε implies Now we use the property of minimizers as stated by Theorem 3.5, which gives us From (3.14) we thus obtain the stated formula, since f (ε) ≤ 0. For ε = ε k < ε , we make use of the standard Newton iteration In a practical algorithm it is useful to couple the Newton iteration (3.15) with a bisection technique. To do this we adopt a tolerance tol which allows us to distinguish whether ε < ε , in which case we may use the derivative formula and perform the Newton step, or ε > ε , so that we have to make use of bisection. The method is formulated in Algorithm 1.

4.
The two-level method for the membership-and cardinality-constrained minimum cut problems. 4.1. Functional for the membership-constrained minimum cut problem. Our approach to the membership problem is the same two-level procedure as for the unconstrained minimum cut problem, except that the functional (3.1) is replaced by the following functional: For ε > 0 and a matrix E of unit Frobenius norm, let x = (x i ) ∈ R n be the eigenvector to the second smallest eigenvalue λ 2 of Lap(W + εE). Let V − and V + be the set of indices whose membership to different components of the cut graph is prescribed. Let 0) collect the negative and positive components of x, respectively. Let n − and n + be the numbers of negative and nonnegative components of x, respectively. We denote the averages of x − and x + by x + i .

Algorithm 1: Newton-bisection method for distance approximation
Data: Matrix W is given, k max (max number of iterations), tol (tolerance) ε 0 , ε lb and ε ub (starting values for the lower and upper bounds for ε ) Result: ε (upper bound for the distance), E(ε ) begin 1 Compute E(ε 0 ) by the inner iteration Return ε k+1 and the interval [ε lb , ε ub ] Stop else Set k = k + 1 5 Compute E(ε k ) by the inner iteration 6 Return ε = ε k Motivated by the special form of the eigenvectors as given in the Fiedler theorem (Theorem 2.1), we consider the functional where α > 0 is a weight to be chosen. The choice of the sign of the eigenvector x is such that F ε (E) takes the smaller of the two possible values. This functional is to be minimized under the inequality constraints W + εE ≥ 0, the norm constraint E = 1 and the symmetry and the sparsity pattern of E.

Functional for the cardinality-constrained minimum cut problem.
For the cardinality-constrained problem we use the same functional F ε , except that the sets V − and V + are not given a priori, but are chosen depending on E in the following way: V − and V + collect the indices of the smallest and largest n components of the eigenvector x, respectively, augmented by those indices for which the components of x do not differ by more than a threshold δ from the average of the smallest and largest n components, respectively.  x(t) be the associated eigenvector normalized such that x(t) 2 = 1. Moreover, let M (t) = C(t) − λ(t)I and let M (t) † be the Moore-Penrose pseudoinverse of M (t). Then, the derivative of the eigenvector is given byẋ We remark that in [15] this is formulated with the group inverse, which in the symmetric case is the same as the Moore-Penrose pseudoinverse.
4.3.2. Gradient of F ε . Consider a differentiable path E(t) of ε-feasible matrices, and denote the corresponding Laplacian matrix by L(t) = Lap(W + εE(t)), by λ 2 (t) the second smallest eigenvalue of L(t) , and by x(t) the associated eigenvector. We set and, with e i denoting the ith standard unit vector, We define which is computed as the solution of the linear system We denote by x • y = (x i y i ) the vector obtained by componentwise multiplication of the entries of x and y. We then have the following result. Lemma 4.2. In the above situation we have is symmetric and has the sparsity pattern determined by the set of edges E. Proof. We have d dt and similarly for the sum over V + . With K = (L − λ 2 I) † we obtain from Lemma 4.1 thaṫ Using the expression forL given in (3.4) and proceeding as in the proof of Lemma 3.2 gives the result.
The computational cost of computing G ε (E) lies in computing the second eigenvalue and its eigenvector and in solving the linear system (4.3). For a sparse weight matrix, these computations have a complexity that is linear in the number of vertices. With this gradient G ε (E), the further procedure is now exactly the same as in Section 3.

5.
The two-level method for the ambiguity problem.

Two-level formulation.
For the ambiguity problem we proceed similarly as in Section 3.
1. Given ε > 0, we look for a symmetric matrix E ∈ R n×n with the same sparsity pattern as W (i.e., e ij = 0 if w ij = 0), of unit Frobenius norm, with W + εE ≥ 0 (with componentwise inequality) such that the difference between the third and second smallest eigenvalues of Lap(W + εE) is minimized. The obtained minimizer is denoted by E(ε). 2. We look for the smallest value of ε such that the second and third eigenvalues of Lap(W + εE(ε)) coalesce. In order to compute E(ε) for a given ε > 0, we make use of a constrained gradient system for the functional under the inequality constraints W + εE ≥ 0, the norm constraint E = 1 and the symmetry and the sparsity pattern of E.
In the outer iteration we compute the optimal ε, denoted ε , by a combined Newton-bisection method as in Section 3.

5.2.
Gradient of F ε . Consider a regular path E(t) of ε-feasible matrices, and denote the corresponding Laplacian matrix by L(t) = Lap(W +εE(t)) and by λ 2 (t) and λ 3 (t) the second and third smallest eigenvalues of L(t), respectively. We denote by x(t) and y(t) the corresponding eigenvectors of unit Euclidean norm.
Lemma 5.1. In the above situation we have is symmetric and has the sparsity pattern determined by the set of edges E.
With this gradient we then proceed further as in Section 3.
6.1. Discretizing the constrained gradient flow. We use a modified explicit Euler method for the approximate integration of the differential equation (3.10). For a given ε > 0, a step-size h > 0 and from the ε-feasible perturbation matrix E n of the nth time step, we compute E n+1 as follows. We compute G ε (E n ) = g n ij and define E n+1 with θ ∈ [0, 1) such that w ij + ε e n ij − θhg n ij = 0, that is, with θ = (w ij + εe n ij )/(εhg n ij ). We would ideally take the new perturbation matrix E n+1 such that E n+1 − E n+1 → min subject to E n+1 = 1 and W + εE n+1 ≥ 0.
We approximate this optimization problem by treating the two constraints one after the other in an alternating way. Let E 0 be the set of edges (i, j) ∈ E for which w ij + εẽ n+1 ij = 0 (cut edges), and let P 0 = P E0 and P + = P E\E0 be the complementary projections as defined in Section 3.2.2. We first normalize by choosing ρ > 0 such that has unit Frobenius norm, i.e., (In case that P 0 E n+1 is larger than 1 or very close to 1, we replace P 0 E n+1 by P 0 E n in the two lines above.) We denote by E − the set of inadmissible edges (i, j) for which w ij + εê n+1 ij < 0. We then resetê n+1 augment E 0 := E 0 ∪ E − and consider the updated projection P 0 = P E0 . We then normalize the so obtained matrix E n+1 in the same way as above by leaving the entries of P 0 E n+1 unchanged, reset the entries for inadmissible edges, normalize, and so on. As there are only finitely many edges, this iteration terminates after finitely many steps (typically after the first step). Finally, we have obtained an ε-feasible perturbation matrix E n+1 .
6.2. Choice of step-size. The step-size h can, for example, be selected by the following adaptive algorithm. Here the objective is to reduce the function F ε , not to follow accurately a trajectory of the constrained gradient differential equation.
6.3. Stopping criterion. Let F n = F ε (E n ). In order to stop the integration when F n has approximately reached a stationary value, we use a criterion of the following type: where tol is a tolerance parameter (e.g., tol = 10 −6 ) and β and δ are further parameters. We had good experience with the choice β = 10 · tol and δ = tol/100; see further [5] where also the sensitivity of the algorithm to the chosen parameters is discussed.
6.4. Initial value of the constrained gradient flow for a new ε. When we change to a new value of ε in the outer iteration, we need an initial value for the constrained gradient flow. A first idea might be to take the terminal perturbation matrix E 0 = E(ε old ) as the initial value, but usually this does not satisfy the nonnegativity constraints W + εE 0 ≥ 0 if ε ≥ ε old . We therefore modify E 0 to E 0 by solving approximately E 0 − E 0 → min subject to E 0 = 1 and W + εE 0 ≥ 0, alternating between normalization and enforcing the nonnegativity constraints as in Section 6.1, but this time beginning with the empty set E 0 = ∅. Compute E n+1 (h) and its function value F ε (E n+1 (h)) with the step-size h if F ε (E n+1 (h)) ≥ F ε (E n ) then halve the step-size, h := h/2 and repeat from 2 else if h = h n−1 then compute E n+1 (2h) and its function value Return E n+1 and h n 6.5. Choice of the inital perturbation size ε 0 and the initial perturbation matrix. While one might just start with a random perturbation, a more educated guess starts from the normalized free gradient E 0 = −G ε (0)/ G ε (0) and determines ε 0 as the largest number ε such that W + εE 0 ≥ 0. 6.6. Stopping the outer iteration before convergence. In the exact solution W = W + ε E to the constrained minimum cut problem, the entries of W are either zero or those of W . To decide about the cut, it is therefore not necessary to iterate towards W with very high accuracy, but instead the cut can be inferred earlier from a moderately accurate approximation W + εE(ε), for example using the following criterion, with a small threshold parameter ϑ > 0: Stop if for every edge (i, j) ∈ E, either w ij + εe ij ≤ ϑw ij or |εe ij | ≤ ϑw ij .
In the first case one would then cut to w ij = 0 and in the second case one would leave the weight unchanged: w ij = w ij . It can finally be checked if the so obtained cut graph is indeed disconnected, by computing λ 2 (Lap(W )). Instead, in the ambiguity problem such a shortcut is not feasible.

Numerical examples.
We consider a few illustrative examples for both the cardinality and the membership constraints. At the end we will also consider graphs to illustrate the ambiguity problem.
The standard Fiedler spectral partitioning algorithm, to which we refer below, is simply based on the sign of the components of the eigenvector of Lap(W ) associated to λ 2 .
Example 1 (Zachary's karate club). This weighted graph consisting of 34 vertices describes the relationship between 34 members of a karate club (for a detailed description see [19]). Using the Fiedler spectral partitioning we obtain two connected components of 16 and 18 vertices as shown in Figure 7.1a.
According tho the standard Fiedler partitioning the first component is led by the vertex labeled as 1, while the second one is led by the vertex labeled as 34.
We next consider the following constraints: (i) Cardinality constraint with threshold equal ton = 17 vertices; (ii) Membership constraint; (iii) Both constraints. In more detail: (i) By asking for a cardinality constraint withn = 17 vertices in each component, the approximate computed distance is ε ≈ 10.03631. The results in Table 7.1 are obtained by setting a tolerance tol = 10 −5 and the weight α = 3 in (4.1). With respect to the standard partition obtained by the Fiedler eigenvector of Lap(W ), the vertex that changes partition is the vertex labeled as 9.  (iii) Finally we consider both constraints, that is, we ask for a cardinality constraint with thresholdn = 17 vertices, and we require that vertex 9 is in the same connected component as the vertex 34. Table 7.3 shows values of ε k , f (ε k ) = F ε k (E(ε k )) computed with the tolerance tol = 10 −5 and the weights α c = 3, α m = 10 in the functional F ε that combines the cardinality and membership functionals. We obtain that the vertex 10 further changes the connected component in order to satisfy the cardinality constraint. Example 2 (A misbehavior of the algorithm). We present an example where the algorithm fails.
Consider an unweighted graph with N vertices, such that each vertex 2, . . . , N is connected to the following two vertices, i. e.
The first vertex is connected to the second one, i.e., w 1,2 = 1, but not to the third one. It is clear that the minimum cut is obtained by removing the edge (1, 2), since this is the only possibility to obtain a disconnected graph when only one edge is removed. We tried to solve this example for different values of N . The algorithm works correctly when N = 8 but fails when N ≥ 12.
In the latter case we obtain a disconnected graph, but with the wrong edges removed. For  [14]. Two books are linked if they were purchased by the same person, and the books are colored red, blue or green, based on book buying data (see Fig.(7.3b)). The links determine the grouping and coloring of the vertices. The vertices are colored by Fiedler spectral partitioning in Figure 7.3a. By this partitioning we obtain two connected components of 52 and 53 vertices. We ask for the   Table 7.4) for each one of the vertex in the green group of Figure 7.3b to belong to the blue group (ε b ) or to belong to the red group (ε r ). The results reported in the tables are obtained with the weight α = 1. Example 4 (Les Miserables). Figure 7.4 shows the graph of character co-occurence in Les Miserables [13]. This graph consists of 77 vertices (representing characters). According to the Fiedler partitioning, 22 of these belong to one part and the remaining 55 belong to the other part. Asking for the partitioning of the graph with the cardinality constraint with threshold n = 35, we obtain the result shown in Figure 7  Example 5 (Planted Partition Model -ambiguity problem). We consider here a class of graphs for which we investigate the distance to ambiguity (that is, a coalescence of the second and third eigenvalues in the associated Laplacian matrix). We consider Planted Partition Models [4], which constitute a special case of Stochastic Block models, a commonly used generative model for social and biological networks. The probability matrix consists of a constant value p in on the diagonal and a different constant value p out off the diagonal; in addition, the number of vertices is n = 40, while the communities are 4, each one made of 10 vertices. In Figure 7.3 we can see two Planted Partition Models; on the left when p in = 0.8 and p out = 0.2, on the right when p in = 0.9 and p out = 0.1. In Table 7.5 a comparison among various values of p in and p out is shown. These results are obtained by setting the tolerance to tol = 10 −5 .  The results show that relatively small perturbations may yield an ambiguity in the Fiedler partitioning for these graphs.