Maximal Linear Arrangement is NP complete on Bipartite Graphs
Aparna Das, Jonathan Needleman
Maximum Linear Arrangement is NP complete on Bipartite Graphs
Aparna Das
Jonathan Needleman
October 12, 2026
Abstract
The linear arrangement of a simple graph G=(V,E) is a bijective labeling π of the vertices of G to the set {1,…,n}. The maximum linear arrangement (MaxLA) problem is to determine whether G has a labeling such that the sum of labels across G's edges, ∑uv∈E∣π(u)−π(v)∣, is at least a given value k. Minimum linear arrangement (MinLA) is defined analogously.
Both MaxLA and MinLA are known to be NP complete for general graphs. MinLA was shown to be NP complete for bipartite graphs by Evans and Shiloah in 1975 [7]. It has been an open problem whether the same holds for MaxLA. In this paper we prove that MaxLA is NP complete for bipartite graphs.
1 Introduction
A linear arrangement of a simple graph G=(V,E) is a bijective labeling π of the vertices of G to the set {1,…,n}. The linear arrangement sum is defined by extending π to a function on the edges, where for each edge e=xy∈E, π(e)=∣π(x)−π(y)∣. The sum is then
Dπ=e∈E∑π(e)
and the maximum sum of G is defined as D(G)=maxπDπ.
The maximum linear arrangement problem (MaxLA) takes a graph G and a value k and asks whether D(G)≥k. The minimum linear arrangement problem (MinLA) is defined analogously.
Both MaxLA and MinLA were shown to be NP complete on general graphs [8]. Since the 1970s, MinLA has been studied more extensively than MaxLA. For example, MinLA is also known to be NP Complete for bipartite graphs [7], interval graphs, and permutation graphs [4]. See [6] and [11] for a survey.
Recently, however there have been a number of new results for MaxLA. Devos and Nurse show that the problem is NP-Hard on directed planar graphs [5], suggesting MaxLA may be NP-Hard also for bipartite graphs. In contrast, Hassin and Rubinstein showed a 2-approximation exists for the generalized weighted version of MaxLA [9]. Azar and Vainstein improved these results by showing that in metric space the problem admits an approximation scheme (1−ϵ-approximation for any constant ϵ>0) [3]. Alemany-Puig et al. showed that MaxLA can be solved for projective and planar variants of trees in linear time [1]. The same authors studied a variation of MaxLA for bipartite graphs G=(V1∪V2,E), called bipartite MaxLA where the labels of V1 are constrained to be smaller than the labels of V2. They give a linear time algorithm to solve bipartite MaxLA [2]. These positive results give hope that MaxLA could be solvable on bipartite graphs.
Our main result resolves this tension by showing that MaxLA is NP complete on bipartite graphs. Since maximizing the linear arrangement sum of any graph G minimizes the sum of its complement graph Gˉ [5], our result immediately implies that MinLA is NP complete on the complement of bipartite graphs.
2 Notation and Known Results
Let G=(V,E) be a graph with ∣V∣=n and let π be an arrangement of its vertices. It is helpful to think of a linear arrangement π as a mapping of vertices V onto the integers on the number line from 1 to n. Then when π(x)<π(y) we can say that vertex x is to the left of vertex y and y is to the right of x. We denote the neighbors of a vertex u∈V as N(u)={v∈V∣uv∈E} and define the left (resp. right) directional degree of a vertex u, as its number of neighbors to the left (resp. right) in the arrangement π as
For a given arrangement, the cut width of a position 1≤i≤n is
cπ(i)=∣{uv∈E∣π(u)≤i,π(v)>i}∣.
It will be useful to talk about the cut width of a vertex v∈V. To do this, we abuse notation and say cπ(v)=cπ(π(v)).
Devos and Nurse introduced a robust framework for understanding arrangements [10, 5]. Although the framework was defined for directed graphs, as noted by Puig et al. [2], it also applies to undirected graphs. We present the parts that will be most helpful in this paper. First, they note that cut widths sum up to Dπ, namely
Dπ=i=1∑ncπ(i).(1)
They define the level for a vertex v∈V as the difference between its right and left degrees ie., lπ(v)=rπ(v)−lπ(v). Level values are connected to cut widths as follows: For an arrangement π which orders vertices as (v1,v2,…,vn),
cπ(i)=j=1∑ilπ(vi).(2)
Thus Dπ can be calculated by using the cut widths or levels produced by π.
Devos and Nurse also show that in a maximal linear arrangement level values are monotonically increasing from left to right and vertices of equal levels can exchange positions in the arrangement without decreasing the sum.
Lemma 1. [10, 5] If π∗ is a maximal linear arrangement, then the level values of vertices are monotonically non-increasing with respect to the arrangement. Thus if π∗(u)<π∗(v) then lπ∗(u)≥lπ∗(v). Additionally, vertices with equal levels can exchange positions without decreasing Dπ∗.
3 The Main Result
To show NP completeness we reduce the minimum bisection problem to an instance of MaxLA on a bipartite graph. The minimum bisection problem which is known to be NP complete [8] takes as input a simple graph G=(V,E) with an even number of vertices. The goal is to partition the vertices of G into two sets of equal size, so that the number of edges with exactly one endpoint in each set is minimized.
For our reduction, we construct a new bipartite graph G′=(V′,E′) that contains all original 2n vertices of G along with O(n5) new vertices. We add edges to G′ to ensure that D(G′) is maximized only if the original vertices are bisected into two separate regions of equal sizes, and if the number of edges that go between the two regions is minimized.
The construction of G′ is described in section 3.1. The subsequent sections proves properties about the maximum linear arrangement of G′ and Theorem 6 uses these properties to show that the MaxLA arrangement of G′ implies a minimum bisection for G.
3.1 Bipartite Graph Construction for MaxLP
Define a bipartite graph G′=(V′,E′) from G=(V,E) as follows. Let VE={vij∣1≤i<j≤2n,vivj∈E} and Ui={uij∣1≤j≤n4}. Define V′ as
V′=V∪VE∪(i=1⋃2nUi)
For convenience we will denote U=⋃i=12nUi. There will be two types of edges in E′ : first vivij∈E′ if and only if vivj∈E. Second viujk∈E′ if and only if i=j, thus vi is connected to all the n4 vertices in each Uj where j=i. An illustration of G′ is shown in Figure 1.
3.2 Arranging original vertices
We establish how a MaxLA labeling of G′ will arrange the original vertices V relative to U. By Lemma 2 each v∈V will be either left of, or right of all of U.
Figure 1: Blowup of G to construct G′
Proposition 2. Let π∗ be a maximal labeling of G′. Then for each vi∈V, vi is either left of all u∈U or right of all u∈U.
Proof. Let π be an arrangement of G′ and let vi∈V be the leftmost vertex with U vertices on both its left and right. Define those left and right vertices as
Li={u∈U∣π(u)<π(vi)}andRi={u∈U∣π(u)>π(vi)}.
Without loss of generality assume ∣Li∣≤∣Ri∣ and let uL be the leftmost vertex of Li. Define a new function π′ on G′ which agrees with π everywhere except it swaps the labels of vi and uL so that, π′(vi)=π(uL) and π′(uL)=π(vi).
We show Dπ′≥Dπ. As only edges that involve vi or uL change from Dπ′ and Dπ, we show that
This sum is dependent on d=∣π(uL)−π(vi)∣. Consider the first sum. Swapping the label of uL with vi may have moved uL closer to each of its at most 2n−1 connections in V by d. Therefore,
x∈V′∑π′(xuL)−π(xuL)≥−d(2n−1).
The second sum is more complicated to analyze as there are more edges involving vi. We break up the sum by different sets of edges as
There are at least ∣Ri∣−n4 edges from Ri to vi. Each of these edges contribute d more to the sum under π′ thus,
uvi∈Ri∑π′(uvi)−π(uvi)≥d(∣Ri∣−n4).
Next, consider the edges from Li. Let X={x∈V′∣π(uL)≤π(x)<π(vi)} be the vertices between uL and vi. Notice, that Li⊆X and that ∣X∣=d by the choice of uL as the leftmost U vertex from vi. Let a=∣Li−Ui∣ so a is the number of vertices in Li with an edge to vi. Let b=d−a, be the number of the vertices from X without edges to vi. The sum ∑u∈Li−Uiπ′(uvi)−π(uvi) is minimized when the a vertices with edges to vi are leftmost in X. In this case,
As d≥∣Li∣, this simplifies to, Dπ′−Dπ≥d(∣Ri∣−2n4−n2−4n+2). As ∣Ri∣≥n5, the equation is positive for n≥3.
3.3 Arranging U vertices
By proposition 2 in a maximal labeling π each v∈V lies to the left of all u∈U or to the right of all u∈U. We define VL and VR for each possibility as
Without loss of generality, denote the vertices of VL(π) as v1,v2,…,vk−1 where π(v1)>π(v2)>⋯>π(vk−1), and denote the vertices of VR(π) as vk,…,v2n where π(vk)>π(vk+1)>⋯>π(v2n). The next lemma fixes an ordering of U based on this notation and establishes that U will be ordered left to right as U1,U2,…,U2n. Figure 2 shows the arrangement.
Figure 2: Arrangement of vertices after Lemma 3
Lemma 3. If π∗ is a maximal linear arrangement of G′ then for all ul∈UL and ur∈UR, π∗(ul)<π∗(ur). Additionally, for ui∈Ui, uj∈Uj if i<j then π∗(ui)<π∗(uj).
Proof. The level of ul∈UL is lπ∗(u)=rπ∗(ul)−lπ∗(ul)=∣VR∣−(∣VL∣−1). Similarly, the level of ur∈UR is lπ∗(ur)=∣VR∣−1−∣VL∣. Since lπ∗(ul)>lπ∗(ur), by Lemma 1, π∗(ul)<π∗(ur). Furthermore, as vertices in UL(π∗) have the same level they can be rearranged among themselves so that π∗(ui)<π∗(uj) when i<j without decreasing Dπ∗. The same holds for UR(π∗).
3.4 Bisection of original vertices
We now show that the maximal arrangement will bisect the vertices of G.
Lemma 4. Let π be a labeling of G′ as in Lemma 3, then there is a labeling π′ of G′ such that ∣VL(π′)∣=∣VR(π′)∣ and Dπ′≥Dπ.
Proof. Let π be the labelling established in Lemma 3. Assume without loss of generality that ∣VR(π)∣>∣VL(π)∣ and let vk be the rightmost vertex in VR(π). We define a new labeling π′ which moves vk into VL as follows. Shift vertices that are left of vk right by one by setting π′(x)=π(x)+1 for all x∈V′ where π(x)<π(vk). Then set π′(vk)=1. For all other v∈V′ let π′(v)=π(v).
Since the sum of cut widths across all vertices is equal to the linear arrangement sum, we show Dπ′>Dπ by examining how cut widths change from π and π′. For convenience we define the function Δc(v)=cπ′(v)−cπ(v) for v∈V′ and for A⊂V′ we say Δc(A)=∑v∈AΔc(v). In particular, Δc(V′)=Dπ′−Dπ which we wish to show is positive.
The only edges that change their contribution from π to π′ are those that involve vk. Thus, for any v∈V′Δc(v) depends on v's position relative to N(vk). An edge xvk where x∈N(vk) counts in cπ(v) if π(x)≤π(v), and it counts in cπ′(v) if π′(x)>π′(v). To simplify calculations, we define for each v∈V′ the cut-width contribution from vk neighbors from VE and from U separately as
If we define ΔcE(v)=cπ′E(v)−cπE(v) and ΔcU(v)=cπ′U(v)−cπU(v) then Δc(v)=ΔcU(v)+ΔcE(v). Extending ΔcE, ΔcU to sets the way we did with cπ we have Δc(V′)=ΔcE(V′)+ΔcU(V′).
For any v∈V′, ΔcE(v)≥−2n. Summing over the 2n5+2n2+2n elements of V′ we see that ΔcE(V′) decreases by at most
∣ΔcE(V′)∣≤∣−2n∣V′∣∣=2n(2n5+2n2+2n)=O(n6)(3)
We compute ΔcU(V′) in parts as ΔcU(V′)=ΔcU(V)+ΔcU(VE)+ΔcU(U). For each v∈VL∪{vk}, as vk was moved to the leftmost position of VL by π′, ΔcU(v)=∣U−Uk∣=2n5−n4. For v∈VR−{vk}, as vk was in rightmost position of VR in π, ΔcU(v)=−∣U−Uk∣=−(2n5−n4). Combining, we have ΔcU(V)=(2n5−n4)(∣VL∣+1)−(2n5−n4)(∣VR∣−1)=(2n5−n4)(∣VL∣−∣VR∣+2). As ∣VL∣−∣VR∣≥−2n, ΔcU(V) decreases by at most
∣ΔcU(V)∣≤∣(2n5−n4)(−2n+2)∣=O(n6)(4)
Next, for v∈VE, ΔcU(v)≥−∣U−Uk∣=−(2n5−n4). As ∣VE∣≤2n2, summing over VE shows that ΔcU(VE) decreases by at most
∣ΔcU(VE)∣≤(2n5−n4)∣VE∣=O(n7)(5)
Turning to ΔcU(U), for 1≤i≤k−1, ΔcU(Ui)=−ΔcU(U2n−i+1). Similarly, for k+1≤i≤n, ΔcU(Ui)=−ΔcU(U2n−i+2). As a result of these cancellations, ΔcU(U)=ΔcU(Uk)+ΔcU(Un+1). We look at ΔcU(Uk). Under π′ the cut width of u∈Uk includes all vertices in ⋃i=k+12nUi, so cπ′U(u)=n4(2n−k). Under π the cut width includes all vertices in ⋃i=1kUi, so cπU(u)=n4(k−1). Thus ΔcU(u)=n4(2n−2k+1). Summing over the n4 vertices of Uk yields ΔcU(Uk)=n8(2n−2k+1). As k<n, ΔcU(Uk)≥n8.
Finally we calculate ΔcU(Un+1). As vk is adjacent to n5−n4 vertices in ⋃i=1nUi and also in ⋃i=n+22nUi, those edges cancel in the computation of ΔcU(Un+1). Now consider the edges from vk to Un+1 by numbering the vertices of Un+1 from left to right as u1,u2,…,un4. For uj∈Un+1, there are n4−j vertices of Un+1 that are right of uj and j that are left of uj which are adjacent to vk. So ΔcU(uj)=n4−2j. Summing over 1≤j≤n4, yields ΔcU(Un+1)=−n4. Thus ΔcU(U) increases by at least
ΔcU(U)=ΔcU(Uk)+ΔcU(Un+1)≥n8−n4=n8+O(n4)
Combining the above with equations 4, 5 and 3, we find that Δc(V′) is positive for sufficiently large n as n8 is the dominant term below
We analyze the arrangement of VE considering three groups: VLL={vij∣vi,vj∈VL,1≤i<j≤n}, both edge endpoints are in VL,
VRR={vij∣vi,vj∈VR,n+1≤i<j≤2n}, both endpoints are in VR,
VLR=VE−(VLL∪VRR), one endpoint in VL and the other in VR.
The next lemma shows that VRR will be between VL and UL, VLR will be between UL and UR and VLL will be between UR and VR. The final arrangement is shown in Figure 3.
Lemma 5. Let π∗ be a maximal labeling of G′ that conforms to Lemma 4.
If vij∈VRR, then for all ul∈UL, and vl∈VL, π∗(vl)<π∗(vij)<π∗(ul).
If vij∈VLL, then for all ur∈UR, and vr∈VR, π∗(ur)<π∗(vij)<π∗(vr).
If vij∈VLR, then for all ul∈UL and ur∈UR, π∗(ul)<π∗(vij)<π∗(ur).
Proof. Observe that as all U vertices appear to the left of v1, the level of vl∈VL is at least (2n−1)n4−(2n−1)>n4. Similarly the level of vr∈VR is at most (2n−1)−(2n−1)n4<−n4. Next, observe that the level of vij∈VE must be one of the following values {−2,0,2} as each vij has exactly two neighbors. Thus l(vl)>n4>l(vij)>l(vr)>−n4 which means that a vij∈VE must lie between VL and VR. So we have π∗(vl)<π∗(vij)<π∗(vr).
Now consider the level of U vertices. Since by Lemma 4 ∣VL∣=∣VR∣, the level of ul∈UL is ∣VR∣−(∣VL∣−1)=1, and the level of ur∈UR is ∣VR∣−1−∣VL∣=−1.
The two neighbors of vij∈VRR, are both in VR, so l(vij)=2>l(ul)=1. Thus, vij lies to the left of ul∈UL so π∗(vij)<π∗(ul).
For vij∈VLL, as its two neighbors are both in VL, l(vij)=−2<l(ur)=−1. Thus, vij must lie to the right of ur∈UR so π∗(ur)<π∗(vij).
Finally vij∈VLR, has one neighbor in each VL and VR, so l(vij)=0. Thus vij must lie between ul∈UL and ur∈UR so π∗(ul)<π∗(vij)<π∗(ur).
3.6 Reduction to minimum bisection
Theorem 6. MaxLA is NP complete for bipartite graphs.
Proof. Given input G=(V,E) for the minimum bisection problem we construct G′ as described in section 3.1. A MaxLA arrangement of G′, π, satisfies the conditions of Lemma 5. Figure 3 shows how V′ is arranged by π and denotes the number of vertices in each region as m=∣VE∣ and mL=∣VLL∣, mR=∣VRR∣, and mC=∣VLR∣. By Lemma 4, the original vertices of G are bisected and ∣VL∣=∣VR∣=n. To finish the proof we show that Dπ is maximized when the number of edges between the bisected vertices, mC, is minimized. Thus solving MaxLA on G′ gives us a minimum bisection solution for G.
To calculate Dπ we sum cut widths, which are themselves found by summing level values of a vertex and those to its left using equations 1 and 2.
We calculate cut widths for each set of vertices separately starting with vi∈VL. For vi∈VL, lπ(vi)=2n5−n4+deg(vi). As 0≤deg(vi)≤2n−1, by equation 2 the cut width of vi is
Next consider vi∈VR. We sum the levels of all vertices to its left. The sum of the levels of VL is given by cπ(v1). For edge vertices e∈VRR, lπ(e)=2, for e∈VLR, lπ(e)=0 and for e∈VLL, lπ(e)=−2. For u∈UL, lπ(u)=1, and for u∈UR, lπ(u)=−1. Finally, for vi∈VR, lπ(vi)=−2n5−n4−deg(vi)=−2n5−n4+O(n). Thus the cut width for vi∈VR where n+1≤i≤2n is
As O(m)≤O(n2), the sum of V's cut widths is cπ(V)=2n7−n6+O(n3).
Next we look at the cut widths sums of VRR, VLL and VLR. Label the vertices of each set from left to right as e1, e2, …. For ei∈VRRcπ(ei)=cπ(v1)+2i. For ei∈VLR, cπ(ei)=cπ(v1)+2mR+n5. For ei∈VLL, cπ(ei)=cπ(v1)+2mR−2i. Summing cut widths over the size of each set we have,
As n and m are fixed by the input G, and the term involving mc dominates O(n4), Dπ is maximized when mC is minimized. Since minimizing mC (minimum bisection) is NP-hard [8], so is maximizing Dπ.
References
[1] Lluís Alemany-Puig, Juan Luis Esteban, and Ramon Ferrer i Cancho. The maximum linear arrangement problem for trees under projectivity and planarity. Information Processing Letters, 183:106400, 2024. URL: https://www.sciencedirect.com/science/article/pii/S0020019023000431, doi:10.1016/j.ipl.2023.106400.
[2] Lluís Alemany-Puig, Juan Luis Esteban, and Ramon Ferrer i Cancho. Maximum linear arrangement: exact algorithms for specific classes of graphs and approximation algorithms for wide classes of graphs, 2026. URL: https://arxiv.org/abs/2312.04487, arXiv:2312.04487.
[3] Yossi Azar and Danny Vainstein. Multi Layer Peeling for Linear Arrangement and Hierarchical Clustering. In Kousha Etessami, Uriel Feige, and Gabriele Puppis, editors, 50th International Colloquium on Automata, Languages, and Programming (ICALP 2023), volume 261 of Leibniz International Proceedings in Informatics (LIPics), pages 13:1–13:18, Dagstuhl, Germany, 2023. Schloss Dagstuhl – Leibniz-Zentrum für Informatik. URL: https://drops.dagstuhl.de/entities/document/10.4230/LIPics.ICALP.2023.13, doi:10.4230/LIPics.ICALP.2023.13.
[4] Johanne Cohen, Fedor Fomin, Pinar Heggernes, Dieter Kratsch, and Gregory Kucherov. Optimal linear arrangement of interval graphs. In Rastislav Královič and Paweł Urzyczyn, editors, Mathematical Foundations of Computer Science 2006, pages 267–279, Berlin, Heidelberg, 2006. Springer Berlin Heidelberg.
[5] Matt DeVos and Kathryn Nurse. A maximum linear arrangement problem on directed graphs. CoRR, abs/1810.12277, 2018. URL: http://arxiv.org/abs/1810.12277, arXiv:1810.12277.
[6] Josep Díaz, Jordi Petit, and Maria Serna. A survey of graph layout problems. ACM Comput. Surv., 34(3):313–356, sep 2002. doi:10.1145/568522.568523.
[7] S. Even and Y. Shiloah. Np-completeness of several arrangement problems. Technical report TR-43, , Dept. of Computer Science, Technion, Haifa, 1975.
[8] M. R. Garey, D. S. Johnson, and L. Stockmeyer. Some simplified np-complete problems. In Proceedings of the Sixth Annual ACM Symposium on Theory of Computing, STOC '74, page 47–63, New York, NY, USA, 1974. Association for Computing Machinery. doi:10.1145/800119.803884.
[10] Kathryn Nurse. Maximum linear arrangement of directed graphs. Masters Thesis, Simon Fraser University, 2019. URL: https://summit.sfu.ca/item/19406.
[11] Jordi Petit. Addenda to the survey of layout problems. Bulletin of the European Association for Theoretical Computer Science EATCS, 105, 01 2011.