1 Introduction

We refer to Bondy and Murty (2008) about graph theory terminolgy and facts. Given an undirected graph \(G = (V, E)\) and positive weights \(w_{ij} = w_{ji}\) on the edges \((i, j)\in E\), the maximum (respectively, minimum) cut problem (MAX CUT, (respectively, MIN CUT)) is that of finding the set of vertices S that maximizes (respectively, minimzes) the weight of the edges in the cut \((S, V\backslash S)\) or \(\delta (S)\) or \(\delta (V\backslash S)\); that is, the weight of the edges linking all vertices of S to those of \(V\backslash S\). The (decision variant of the) MAX CUT is one of the Karp’s original NP-complete problems (Karp 1972), and has long been known to be NP-complete even if the problem is unweighted; that is, if \(w_{ij} = 1\) for all \((i, j)\in E\) (Garey et al. 1976). This motivates the research to solve MAX CUT in special classes of graphs. MAX CUT problem is solvable in polynomial time for the following special classes of graphs: planar graphs (Barahona 1990; Hadlock 1975; Orlova and Dorfman 1972), line graphs (Guruswami 1999), graphs with bounded treewidth, or cographs (Bodlaender and Jansen 2000). But the problem remains NP-complete for chordal graphs, undirected path graphs, split graphs, tripartite graphs, graphs that are the complement of a bipartite graph (Bodlaender and Jansen 2000) and planar graphs if the weights are of arbitrary sign (Terebenkov 1991). Besides its theoretical importance, MAX CUT problem has applications in circuit layout design and statistical physics (Barahona et al. 1988). For a comprehensive survey of MAX CUT, the reader is referred to Poljak and Tuza (1995) and Ben-Ameur et al. (2014). The best known algorithm for MAX CUT in planar graphs has running time complexity \(O(n^{3/2} log n)\), where n is the number of vertices of the given graph (Shih et al. 1990). The main result of this paper is to exhibit a quadratic time algorithm for a special variant of MAX CUT in graphs without the excluded minor \(K_5\backslash e\).

Let us give some definitions. Given an undirected graph \(G = (V, E)\) and a subset of vertices U, a connected cut \(\delta (U)\) is a cut where both induced subgraphs G[U] and \(G[V\backslash U]\) are connected. Special connected cuts are trivial cuts, i.e., cuts with one single vertex in one side (when this vertex is not a disconnecting vertex). The corresponding weighted variant of MAX CUT for connected cuts is called connected maximum cut problem (CMAX CUT). It is clear that MAX CUT and CMAX CUT are the same problem for complete graphs. Since MAX CUT is NP-hard for complete graphs (see Karp 1972) then CMAX CUT is also NP-hard in the general case. Another theoretical motivation is that CMAX CUT gives a lower bound for MAX CUT.

CMAX CUT has been proved NP-hard for planar graphs (Haglin and Venkatesan 1991) and a linear time algorithm for series parallel graphs is presented by Chaourar (2010).

Some applications of CMAX CUT are: computing a market splitting for electricity markets (Grimm et al. 2019; Kleinert and Schmidt 2018), forest planning problems (Carvajal et al. 2013), phylogenetics (Liers et al. 2016), image segmentation (Vicente et al. 2008), and graph coloring (Hojny and Pfetsch 2018).

We can see through the following application of a variant of the minimum convex coloring (Kammer and Tholey 2012) that considering special classes of graphs is a prior design of the network topology. Given a computer network (graph), where the vertices are routers, and a weight function defined on the links (edges), we want to partition this network into at most two subnetworks such that the total weight of the active links is minimum. This is equivalent to the connected max cut for these graph and weight function. And forcing the network to have the topology of a certain kind of graph is a prior design of this network. So solving CMAX CUT in special classes of graphs have an impact for applications.

Let \(G_1\) and \(G_2\) be two graphs with \(v_j\) a vertex (respectively, \(e_j\) an edge) of \(G_j, j = 1, 2\). The 1-sum (respectively, 2-sum) of \(G_1\) and \(G_2\) based on the vertices \(v_j\in V(G_j)\) (respectively, edges \(e_j\in E(G_j)\)), \(j=1, 2\), denoted \(G_1\oplus _v G_2\) or \(G_1\oplus G_2\) (respectively, \(G_1\oplus _e G_2\) or \(G_1\oplus _2 G_2\)), is the graph obtained by identifying \(v_1\) and \(v_2\) (respectively, \(e_1\) and \(e_2\)) on a new vertex v (respectively, edge e), and keeping \(G_j\) (respectively, \(G_j\backslash e_j\)), \(j = 1, 2\), as they are. Moreover, we can define the 2-sum for two subsets \(F_j\subseteq E(G_j)\), \(j=1, 2\), as the edge set of the 2-sum of their corresponding subgraphs \((V(F_j), F_j)\), \(j=1, 2\). Finally, for two classes \({\mathcal {X}}_j\subseteq 2^{E(G_j)}\), \(j=1, 2\), \({\mathcal {X}}_1\oplus _2 {\mathcal {X}}_2=\{X_1\oplus _2 X_2\) such that \(X_j\in {\mathcal {X}}_j\), \(j=1, 2\}\).

Let \({\mathcal {G}}_0\) be the class of wheels \(W_n\) (where \(n=|V(W_n)|\ge 4\)), the prism \(P_6\), \(K_3\), and \(K_{3, 3}\), and \({\mathcal {G}}(K_5\backslash e)\) be the class of graphs without \(K_5\backslash e\) as a minor. In this paper, we prove that CMAX CUT is polynomial (time) for this class of graphs. For the best of our knowledge, this is the largest known class of graphs for which CMAX CUT is polynomial. Since CMAX CUT is also NP-hard in planar graphs, i.e., graphs without the two excluded minors \(K_5\) and \(K_{3, 3}\), so proving its polynomiality in \({\mathcal {G}}(K_5\backslash e)\) is almost at the frontier of classes of graphs for which the considered problem is NP-hard and those for which it is polynomial.

We have the following characterization of \({\mathcal {G}}(K_5\backslash e)\) (Wagner 1960).

Theorem 1

A graph \(G\in {\mathcal {G}}(K_5\backslash e)\) if and only if G is obtained by taking 1-sums and/or 2-sums of graphs of \({\mathcal {G}}_0\).

Given a positive rational \(\alpha \) and a class of graphs \({\mathcal {G}}\), we say that \({\mathcal {G}}\) is \(\alpha \)-polynomial for CMAX CUT (respectively, MIN CUT) if there exists a polynomial algorithm with running time complexity \(O(n^{\alpha })\) which solves the considered problem for any graph \(G\in {\mathcal {G}}\), where \(n=|V(G)|\). In this case, we say that such a graph G is \(\alpha \)-polynomial for the considered problem. The class of all connected cuts of a given graph G is denoted by \({\mathcal {C}}(G)\). Moreover, for \(e\in E(G)\), the class of connected cuts of G containing e is denoted by \({\mathcal {C}}_e(G)\).

We can see the hardness of CMAX CUT by enumeration through the following.

Proposition 1

$$\begin{aligned} |{\mathcal {C}}(K_n)|={\left\{ \begin{array}{ll} 2^{n-1}-1 &{} if\> n\> is\> odd \\ 2^{n-1}-1-\frac{1}{2}{n\atopwithdelims ()\frac{n}{2}} &{} if\> n\> is\> even \\ \end{array}\right. } \end{aligned}$$

Since CMAX CUT is NP-hard for planar graphs, then it is also NP-hard for graphs without the excluded minor \(K_5\). So our main result is interesting because it deals with the class of graphs without the excluded minor \(K_5\backslash e\).

Another result in this paper is about Hamilton cycle problem (HC): given a graph G, the question is: is there a Hamilton cycle in G. It is known that HC is NP-complete for maximal planar graphs (Nishizeki et al. 1983). We deduce a quadratic time algorithm for solving HC in graphs without the two excluded minors \(P_6\) and \(K_{3, 3}\).

The remaining of the paper is organized as follows: in Sect. 2, we prove that the class of graphs without the excluded minor \(K_5\backslash e\) is 2-polynomial for CMAX CUT and MIN CUT without computing the maximum flow for the latter problem. We also deduce that HC is polynomial for graphs without the two excluded minors \(P_6\) and \(K_{3, 3}\). Then we conclude in Sect. 3.

2 \({\mathcal {G}}(K_5\backslash e)\) is 2-polynomial for CMAX CUT and MIN CUT

First, we state the following lemma about the class of connected cuts when taking 2-sums.

Lemma 1

  1. 1.

    \({\mathcal {C}}(G_1\oplus G_2)={\mathcal {C}}(G_1)\cup {\mathcal {C}}(G_2)\).

  2. 2.

    \({\mathcal {C}}(G_1\oplus _2 G_2)={\mathcal {C}}(G_1/e_1)\cup {\mathcal {C}}(G_2/e_2)\cup [{\mathcal {C}}_{e_1}(G_1)\oplus _2 {\mathcal {C}}_{e_2}(G_2)]\).

Proof

(1) is trivial and (2) is direct because \({\mathcal {C}}(G_1\oplus _2 G_2)=\{ \varOmega _j\in {\mathcal {C}}(G_j) : e_j\notin \varOmega _j, j=1, 2\}\cup \{ \varOmega _1\oplus _2 \varOmega _2 : \varOmega _j\in {\mathcal {C}}(G_j)\) and \(e_j\in \varOmega _j, j = 1, 2\}\). \(\square \)

Now we start the process for proving the main result.

Lemma 2

Let \(\alpha >0\) be a rational. Then:

  1. 1.

    \(G_1\oplus G_2\) is \(\alpha \)-polynomial for CMAX CUT if and only if \(G_j\), \(j=1, 2\) are too.

  2. 2.

    \(G_1\oplus _2 G_2\) is \(\alpha \)-polynomial for CMAX CUT if and only if \(G_j\), \(j=1, 2\) are too.

Proof

It is not difficult to see that \(\alpha \)-polynomiality for CMAX CUT is preserved by minors. So if \(G_1\oplus G_2\) (respectively, \(G_1\oplus _2 G_2\)) is \(\alpha \)-polynomial for CMAX CUT then \(G_j\), \(j=1, 2\) are too. Now for the inverse way, we will see the two cases separately.

  1. (1)

    According to the previous lemma, we need to solve two CMAX CUT problems, one in each \(G_j\), \(j=1, 2\). So the whole running time complexity for solving CMAX CUT in \(G_1\oplus G_2\) is: \(O(n_1^{\alpha }+n_2^{\alpha })=O((n_1+n_2)^{\alpha })=O(|V(G_1\oplus G_2)|^{\alpha })\), and we are done.

  2. (2)

    Let \(w\in {\mathbb {R}}_+^{E(G_1\oplus _2 G_2)}\), \(n_j=|V(G_j)|\), and \(\varOmega _j\) be a connected w-maximum cut containing \(e_j\) in \(G_j\), \(j=1, 2\), among all connected cuts having the same property. It is not difficult to see that \(\varOmega _1\oplus _2 \varOmega _2\) is a connected w-maximum cut in \(G_1\oplus _2 G_2\) over \({\mathcal {C}}_e(G_1\oplus _2 G_2)\), where e is the new edge obtained by identifying \(e_1\) and \(e_2\). According to the previous lemma, we need to solve four CMAX CUT problems: in both \(G_j/e_j\), \(j=1, 2\), and in both \(G_j\), \(j=1, 2\), by changing the weight of \(e_j\) to sum of all edges weights in order to force the corresponding solutions to contain this edge. Thus there exists an algorithm with running time complexity \(O((n_1-1)^{\alpha }+(n_2-1)^{\alpha }+n_1^{\alpha }+n_2^{\alpha }+3)=O((n_1+n_2-2)^{\alpha })=O(|V(G_1\oplus _2 G_2)|^{\alpha })\) to solve CMAX CUT in \(G_1\oplus _2 G_2\), and we are done. \(\square \)

Theorem 2

\({\mathcal {G}}_0\) is 2-polynomial for CMAX CUT.

Proof

Let \(G\in {\mathcal {G}}_0\) and \(n=|V(G)|\). It suffices to prove that \(|{\mathcal {C}}(G)|\le n^2\) because, in this case, we have to find the maximum weighted element from at most \(n^2\) elements.

Case 1::

If G is \(K_3\) then \(|{\mathcal {C}}(G)|=3\le 9=n^2\).

Case 2::

If G is \(P_6\) then \(|{\mathcal {C}}(G)|=6+9+1=16\le 36=n^2\).

Case 3::

If G is \(K_{3, 3}\) \(|{\mathcal {C}}(G)|=3(3+3+1)+3=24\le 36=n^2\).

Case 4::

Suppose now that G is \(W_n\). We will prove

that \(|{\mathcal {C}}(G)|=1+(n-2)(n-1)\le n^2\). Let \(C_{n-1}\) be the outside cycle of \(W_n\), \({\mathcal {P}}_q\) be the class of simple paths of \(C_{n-1}\) with q vertices and \(1\le q\le n-1\), and \({\mathcal {P}}=\bigcup _{q=1}^{n-1} {\mathcal {P}}_q\). Now let \(\varphi \) be the application defined from \({\mathcal {P}}\) to \({\mathcal {C}}(G)\) such that \(\varphi (P)=\delta (V(P))\). It is not difficult to see that \(\varphi \) is a bijection. In the other hand, \(|{\mathcal {P}}_{n-1}|=1\) and \(|{\mathcal {P}}_q|=n-1\) if \(1\le q\le n-2\). Thus \(|{\mathcal {C}}(G)|=|{\mathcal {P}}|=1+(n-2)(n-1)\), and we are done. \(\square \)

Now we can state our main result.

Corollary 1

\({\mathcal {G}}(K_5\backslash e)\) is 2-polynomial for CMAX CUT.

Proof

Direct from Theorem 1, Lemma 2, and Theorem 2. \(\square \)

We have a similar result for MIN CUT by using the following lemma (Chaourar 2010).

Lemma 3

Given a connected graph \(G=(V, E)\) and a positive weight function w defined on E. Then any w-minimum cut is a connected cut of G.

And we can state a version of Corollary 1 for MIN CUT.

Corollary 2

There exists a quadratic time algorithm for solving MIN CUT in \({\mathcal {G}}(K_5\backslash e)\) without computing the maximum flow.

Proof

Direct from Lemma 3 and by adapting the quadratic algorithm of CMAX CUT. \(\square \)

Note that, according to Proposition 1, \(|{\mathcal {C}}(K_5)|=15\le 25=n^2\). Thus we can get a larger class of graphs by taking 2-sums of \({\mathcal {G}}_0\) and copies of \(K_5\) for which CMAX CUT and MIN CUT have quadratic running time complexity.

In the other hand, by using Lemma 2 and similar decomposition theorems as for Theorem 1, we get linear time algorithms for CMAX CUT and MIN CUT (without computing the maximum flow) in large classes of graphs.

Finally, we can have a quadratic running time complexity for the famous Hamitonian Cycle Problem (HC) in the following class of graphs.

Corollary 3

HC has quadratic running time complexity in graphs without the two excluded minors \(P_6\) and \(K_{3, 3}\).

Proof

Since the duals of the considered class of graphs is a subclass of both planar graphs and \({\mathcal {G}}(K_5\backslash e)\), then deciding if a given graph G from this class contains a Hamiltonian cycle is equivalent to decide if a connected maximum cardinality cut (i.e., CMAX CUT with weights \(w(e)=1\) for any edge e) of the dual graph \(G^*\) has cardinality \(n=|V(G)|\). \(\square \)

This result is interesting because HC is NP-complete in maximal planar graphs (Nishizeki et al. 1983).

3 Conclusion

We have proved that CMAX CUT, MIN CUT, (respectively, HC) have quadratic running time complexity for graphs with the excluded minor \(K_5\backslash e\) (respectively, the two excluded minors \(P_6\) and \(K_{3, 3}\)). Further directions are improving this running time complexity and studying CMAX CUT in larger classes of graphs than \({\mathcal {G}}(K_5\backslash e)\).