• Aucun résultat trouvé

The complexity of deciding whether a graph admits an orientation with fixed weak diameter

N/A
N/A
Protected

Academic year: 2021

Partager "The complexity of deciding whether a graph admits an orientation with fixed weak diameter"

Copied!
13
0
0

Texte intégral

(1)

HAL Id: hal-00824250

https://hal.inria.fr/hal-00824250v6

Submitted on 16 Aug 2016

HAL is a multi-disciplinary open access archive for the deposit and dissemination of sci- entific research documents, whether they are pub- lished or not. The documents may come from teaching and research institutions in France or abroad, or from public or private research centers.

L’archive ouverte pluridisciplinaire HAL, est destinée au dépôt et à la diffusion de documents scientifiques de niveau recherche, publiés ou non, émanant des établissements d’enseignement et de recherche français ou étrangers, des laboratoires publics ou privés.

The complexity of deciding whether a graph admits an orientation with fixed weak diameter

Julien Bensmail, Romaric Duvignau, Sergey Kirgizov

To cite this version:

Julien Bensmail, Romaric Duvignau, Sergey Kirgizov. The complexity of deciding whether a graph admits an orientation with fixed weak diameter. Discrete Mathematics and Theoretical Computer Science, DMTCS, 2016, Vol. 17 no. 3 (3), pp.31-42. �hal-00824250v6�

(2)

The complexity of deciding whether a graph admits an orientation with fixed weak

diameter

Julien Bensmail

1

Romaric Duvignau

2

Sergey Kirgizov

3

1 Technical University of Denmark, Denmark

2 Universit´e de Bordeaux, LaBRI, UMR 5800, CNRS, France

3 Universit´e de Bourgogne Franche-Comt´e, LE2I, UMR 6306, CNRS, France received 18thSep. 2014,accepted 15thJan. 2016.

An oriented graph

Gis said weak (resp. strong) if, for every pair{u, v}of vertices of

G, there are directed paths joininguandvin either direction (resp. both directions). In case, for every pair of vertices, some of these directed paths have length at mostk, we call

G k-weak (resp. k-strong). We consider several problems asking whether an undirected graphGadmits orientations satisfying some connectivity and distance properties. As a main result, we show that deciding whetherGadmits ak-weak orientation isNP-complete for everyk2. This notably implies the NP-completeness of several problems asking whetherGis an extremal graph (in terms of needed colours) for some vertex-colouring problems.

Keywords:oriented graph, weak diameter, strong diameter, complexity

1 Introduction

LetGbe a simple undirected graph with vertex setV(G)and edge setE(G). Byorientingevery edgeuv ofG, either fromutovor fromvtou, one obtains anorientation

GofG. This oriented graph Ghas the same vertex set asG,i.e.V(

G) =V(G), and, for every edgeuvE(G), we have eitheruvE( G)or

vuE(

G)depending on the orientation assigned touv.

The distancedist(G, u, v)from utov inG is the minimal length of a path joining uandv. We refer to the maximum distance between two vertices ofGas itsdiameter, and denote itdiam(G). These definitions can be naturally adapted to the context of oriented graphs. A dipath of

G is a sequence (v1, v2, ..., vk)of distinct vertices such that−−−→vivi+1E(

G)for everyi∈ {1,2, ..., k1}. Such a dipath has lengthk1and is written−−−−−→v1v2...vk. Thedirected distancedist(

G , u, v)fromutov in G is the minimal length of a dipath starting fromuand ending atv. Note that, contrarily to the undirected case, we may havedist(

G , u, v)6= dist(

G , v, u). Therefore, two definitions of the oriented diameter can be adopted. Let

1365–8050 c2016 Discrete Mathematics and Theoretical Computer Science (DMTCS), Nancy, France

(3)

distw(

G , u, v) = min{dist(

G , u, v),dist( G , v, u)}

and

dists(

G , u, v) = max{dist(

G , u, v),dist( G , v, u)}.

These two measures are called theweak distanceandstrong distance, respectively, fromutovin G. The weak diameterof

G, denoteddiamw(

G), is the maximum weak distance from a vertex to another one.

Thestrong diameterof

G, denoteddiams(

G), is the maximum strong distance from a vertex to another one. The weak diameter can intuitively be seen as an optimistic measure of the directed distances in an oriented graph (basically two verticesuandv are considered close when, say,ucan reachv with few moves, and this no matter how many moves needsvto reachu(if possible)). We call

G k-weak(resp.

k-strong) if it has weak (resp. strong) diameter at mostk. More generally, we say that

G isweak(resp.

strong) if it isk-weak (resp.k-strong) for some finite value ofk. In turn, aweak(resp.strong)orientation of an undirected graph refers to an orientation being a weak (resp. strong) oriented graph.

Many appealing and attractive problems in graph theory are about deducing graph orientations with particular properties. Such problems find natural applications in real-world problems (e.g. traffic prob- lems). In this paper, we mainly focus on the existence of (either weak or strong) orientations of some undirected graphGin which the diameter is preserved,i.e. as close todiam(G)as possible. Though the question of deciding whetherGadmits a weak or strong orientation can be answered easily by using several classic results of graph theory (see Sections 2.1 and 3), the hardness of deciding the same when a (weak or strong) diameter restriction is required was mostly unknown. Our main contribution is an indication of the complexity of answering this problem. In particular, we show that deciding whetherG admits ak-weak orientation isNP-complete for everyk2, and suggest that the same should be true for k-strong orientations, completing a result of Chv´atal and Thomassen.

This paper is organized as follows. In Section 2, we first consider the questions above for the weak notions of distance, orientation, and diameter. Then, we consider, in Section 3, the same questions but for the strong notions of distance, orientation, and diameter. Consequences of our results are then discussed in Section 4. In particular, as side results we get that deciding whether an undirected graph is extremal (in terms of needed colours) for some vertex-colouring problems isNP-complete.

2 Weak orientations

This section is devoted to the following related two decision problems.

WEAKORIENTATION

Instance: A graphG.

Question: DoesGadmit a weak orientation?

k-WEAKORIENTATION

Instance: A graphG.

Question: DoesGadmit ak-weak orientation?

(4)

Using two classic tools of graph theory, we prove, in Theorem 3 below, that WEAKORIENTATIONcan be answered in linear time. Then, we prove thatk-WEAK ORIENTATIONis inPfork = 1, andNP- complete otherwise,i.e. whenever k 2(see Theorem 5). These two results confirm that imposing a (even constant) weak diameter condition is a strong restriction which makes the problem more difficult.

2.1 Complexity of WEAK ORIENTATION

We here show that WEAKORIENTATIONcan be solved in linear time, and is hence inP. For this purpose, we need to recall the following two classic results. Recall that abridge of a graph is an edge whose removal disconnects the graph.

Theorem 1(Tarjan [11]). The bridges of a graph can be found in linear time.

Theorem 2(Robbins [8]). A strong orientation of a bridgeless undirected graph can be computed in linear time.

We also need the notion ofB-contraction. Given an undirected graphG, itsB-contraction is the graph obtained as follows. Let firste1, e2, ..., exdenote the bridges ofG, andB1, B2, ..., Bydenote the (bridge- less) components ofG− {e1, e2, ..., ex}. Then theB-contraction ofGis obtained by associating a vertex vBi with each componentBi, and in which two verticesvBiandvBj are joined by an edge if and only if there is a bridge joiningBiandBjinG. Clearly theB-contraction of any graph is a tree.

We are now ready to introduce the result of this section.

Theorem 3. An undirected graph admits a weak orientation if and only if itsB-contraction is a path.

Proof: We start by proving the sufficiency. Assume G is a connected undirected graph whose B- contraction is a path with successive edgese1, e2, ..., ex, and denoteB1, B2, ..., By the components of G− {e1, e2, ..., ex}. We obtain a weak orientation

GofGas follows. First orient the edgese1, e2, ..., ex

towards the same direction,i.e.following the natural first-last ordering of theB-contraction. Then orient the edges of everyBi to form a strong component. Such an orientation exists according to Theorem 2 since eachBihas no bridge. Clearly

Gis weak since every two vertices within a sameBican reach each other and the orientation of the edgese1, e2, ..., exform a dipath in theB-contraction.

We now prove the necessity by contradiction. Assume theB-contraction ofGis not a path, but G admits a weak orientation

G. Clearly the orientation of

G, restricted to theB-contraction, should be weak. But this is impossible as theB-contraction of Ghas a node with degree at least 3, and every B-contraction is a tree. A contradiction.

Since theB-contraction of any graph can be computed in linear time (due to Theorem 1), we can answer in linear time to every instance of WEAK ORIENTATION. Actually, since the bridges of a graph and a strong orientation of every bridgeless undirected graph can be deduced in linear time (recall Theorems 1 and 2), the algorithm described in the sufficiency part of the proof of Theorem 3 can even be implemented to efficiently construct,i.e.in linear time, a weak orientation (if any) of every undirected graph.

Corollary 4. WEAKORIENTATIONis inP.

(5)

2.2 Complexity of k-WEAK ORIENTATION

Clearly the answer to an instance of 1-WEAKORIENTATIONisyesif and only ifGis complete. So 1- WEAKORIENTATIONis inP. The complexity of every remaining problemk-WEAKORIENTATION(i.e.

withk 2) was mentioned and asked in several references of literature (notably in [6, 9, 10]) due to its relationship with other problems of graph theory (see concluding Section 4). We herein settle the complexity of these problems by showing them to beNP-complete in general.

Theorem 5. k-WEAKORIENTATIONisNP-complete for everyk2.

Proof: For any fixed k, one can, given an orientation

G of G, check in polynomial time whether diamw(

G)k. This can be done by essentially computing, for every pair of distinct vertices ofG, the length of the shortest directed paths joining these two vertices in

G. Many polynomial-time algorithms, such ase.g.the well-known Floyd-Warshall Algorithm (with unit weights), can be found in literature and applied to handle this. Consequently,k-WEAKORIENTATIONis inNP.

Letk2be fixed. We show thatk-WEAKORIENTATIONisNP-hard by reduction from the following problem, which is shown to beNP-complete in [5].

2-VERTEX-COLOURING OF3-UNIFORMHYPERGRAPHS

Instance: A 3-uniform hypergraphH.

Question: IsH2-colourable,i.e.can we colour each vertex ofHeither blue or red so that every hyperedge ofH has at least one blue vertex and one red vertex?

Throughout this proof, for any hypergraph H with order n and size m we denote its vertices by x1, x2, ..., xnand hyperedges byE1, E2, ..., Em. For everyi∈ {1,2, ..., n}, we further denote byni1 the number of distinct hyperedges ofH which contain the vertexxi. From a 3-uniform hypergraphH, we produce a graphGH such thatH is 2-colourable if and only ifGH admits ak-weak orientation−→

GH. This reduction is achieved in polynomial time compared to the size ofH.

We first describe thecruxGcH ofGH,i.e. the subgraph ofGH from which the equivalence withH will follow. The subgraphGcH does not have diameterk, butGH will be augmented later so that it has diameterk, and this without altering the equivalence. The cruxGcH has the following vertices (see Figure 1). With each vertexxiofH, we associateni+ 2verticesui,u0i, andvi,j1, vi,j2, ..., vi,jniinGcH, wherej1, j2, ..., jni are the distinct indices of the hyperedges ofH which containxi. We now associate additional vertices in GcH with each hyperedge Ej of H, wherej ∈ {1,2, ..., m}. This association depends on the parity ofk:

Ifkis even, then add two verticesajanda0jtoGcH.

Otherwise, ifkis odd, then add two cyclesajbjcjajanda0jb0jc0ja0jwith length 3 toGcH.

We now link the vertices ofGcH by means of several vertex-disjoint paths. By “joining a pair{u, v}

of vertices by a path”, we mean that we identify the endvertices of a new path withuandv, respectively.

Since this operation is used at most once for joining any pair{u, v}ofGcH, we use the notationuP vto denote the resulting path (if any). First, join every pair{ui, u0i}by a path with lengthbk2c. Then also join every pair{u0i, vi,j}by a path with lengthdk2e. Now consider each hyperedgeEj ={xi1, xi2, xi3}ofH, and add the following paths toGcH:

(6)

u1 u01 v1,1

a01

u2 u02 v2,1 a1

v3,1

u3 u03 v3,2

u4 u04 v4,1 a2

u5 u05 v5,1

a02

(a) Casekis even. Dashed paths have lengthk2.

a01

b01

c01

u1 u01 v1,1 a1

u2 u02 v2,1

b1

v3,1 c1

u3 u03

v3,2

u4 u04 v4,1

u5 u05 v5,1

a2

b2

c2 a02

b02

c02

(b) Casekis odd. Dashed (resp. dotted) paths have lengthbk

2c(resp.dk

2e).

Figure 1:The crux subgraphGcH ofGHobtained assumingH has two hyperedgesE1 ={x1, x2, x3}andE2 = {x3, x4, x5}.

(7)

Ifkis even, join every pair of{vi1,j, vi2,j, vi3,j} × {aj, a0j}by means of a path with length k2.

Otherwise, ifkis odd, then join every pair of{vi1,j} × {aj, a0j},{vi2,j} × {bj, b0j}, and{vi3,j} × {cj, c0j}by a path with lengthbk2c.

Note that, by construction, exactly one pair{vi,j, s(vi,j)}(resp. {vi,j, s0(vi,j)}) was joined by a path with lengthbk2c, wheres(vi,j)(resp. s0(vi,j)) is a vertex of the formaj,bj or cj (resp. a0j,b0j orc0j).

The notations(vi,j)ands0(vi,j)are used throughout this section. In particular, observe that ifkis even, then we haves(vi1,j) = s(vi2,j) = s(vi3,j) = aj for every hyperedgeEj = {xi1, xi2, xi3}ofH. We analogously haves0(vi1,j) =s0(vi2,j) =s0(vi3,j) =a0j.

A pair{u, v}of distinct vertices ofGcHis saidrepresentativewhenever it matches one of the following forms:

1. {ui, vi,j}wherei∈ {1,2, ..., n},j∈ {1,2, ..., m}, andxiEj. 2. {u0i, s(vi,j)}wherei∈ {1,2, ..., n},j ∈ {1,2, ..., m}, andxi Ej.

3. {vi1,j, vi2,j}wherei1, i2∈ {1,2, ..., n},j ∈ {1,2, ..., m}, andxi1, xi2Ej.

An orientation ofGcHisgoodif every two vertices forming a representative pair are linked by ak-dipath in either direction. Note that, in this definition, there is no requirement on the oriented distance between two vertices which are at distance at leastk+ 1. A representative pair is a pair of vertices which will not be adjacent in the finalGH, and for which there will be at most two paths with length at mostkjoining it.

All of these paths will belong toGcH so that the existence of ak-weak orientation ofGHwill depend on the existence of a good orientation ofGcH.

We prove below that we have an equivalence between finding a proper 2-vertex-colouring ofH and a good orientation ofGcH. The proof relies on the following claims.

Claim 1. Suppose the vertexxibelongs to the hyperedgesEj1, Ej2, ..., Ejni ofH. Then, in any good orientation−→

GcHofGcH, either

−−−−−−−−−−−−−

uiP u0iP vi,jP s(vi,j)is a dipath for everyj∈ {j1, j2, ..., jni}, or

−−−−−−−−−−−−−

s(vi,j)P vi,jP u0iP uiis a dipath for everyj∈ {j1, j2, ..., jni}.

Proof:Note that becauseuiP u0iP vi,j1 is the only path with length at mostkjoininguiandvi,j1inGcH, either−−−−−−−−→

uiP u0iP vi,j1 or−−−−−−−−→

vi,j1P u0iP ui must be a dipath of−→

GcH. Assume−−−−−−−−→

uiP u0iP vi,j1 is a dipath of−→

GcH. Since−−−→

uiP u0i is now a dipath of−→

GcH, then−−−−→

u0iP vi,j must also be a dipath for everyj ∈ {j1, j2, ..., jni} sinceuiP u0iP vi,jis the only path with length at mostkjoininguiandvi,jinGcH.

Similarly, since, for everyj ∈ {j1, j2, ..., jni}, the only path with length at most kjoining u0i and s(vi,j)inGcHisu0iP vi,jP s(vi,j), and−−−−→

u0iP vi,j is a dipath of−→

GcH, then−−−−−−−→

vi,jP s(vi,j)has to be a dipath of

−→GcH. Thus−−−−−−−−−−−−−

uiP u0iP vi,jP s(vi,j)belongs to−→

GcHfor everyj∈ {j1, j2, ..., jni}assuming that−−−−−−−−→

uiP u0iP vi,j1

belongs to the orientation. The claim follows analogously from the assumption that−−−−−−−−→

vi,j1P u0iP ui is a dipath of−→

GcH.

(8)

Claim 2. Supposekis even, andEj={xi1, xi2, xi3}is an hyperedge ofH. Then, in any good orientation

−→GcHofGcH, either−−−−−−−→

vi,jP s(vi,j)or−−−−−−−→

s(vi,j)P vi,j is a dipath for everyi∈ {i1, i2, i3}. Furthermore, these three dipaths cannot be all directed from or towards thes(vi,j)’s.

Proof: Recall thats(vi1,j) =s(vi2,j) = s(vi3,j) =aj ands0(vi1,j) =s0(vi2,j) =s0(vi3,j) = a0jwhen kis even. Note further that there are only two paths with length at mostkjoining any two ofvi1,j,vi2,j, andvi3,j. These includeajanda0j, respectively. If the statement of the claim is not fulfilled, then there is nok-dipath of−→

GcHjoining any two ofvi1,j,vi2,j, andvi3,jincludingaj. So there must be threek-dipaths joining these vertices includinga0j, but this is impossible.

Claim 3. Supposekis odd, andEj ={xi1, xi2, xi3}is an hyperedge ofH. Then, in any good orientation

−→GcHofGcH, either−−−−−−−→

vi,jP s(vi,j)or−−−−−−−→

s(vi,j)P vi,jis a dipath for everyi∈ {i1, i2, i3}. Besides these three dipaths cannot be all directed from or towards thes(vi,j)’s.

Proof: Similarly as for previous Claim 2, if the statement of the claim is not fulfilled by−→

GcH, then there is no dipath with length at mostkjoining any two ofvi1,j,vi2,j, andvi3,j including thes(vi,j)’s. Then there cannot be threek-dipaths, including thes0(vi,j)’s, joining every pair of these vertices, and this no matter how the pathsvi1,js0(vi1,j),vi2,js0(vi2,j)andvi3,js0(vi3,j)are oriented, and how the edges of the cyclesajbjcjajanda0jb0jc0ja0jare oriented.

Regarding previous Claims 2 and 3, remark that if two of the dipaths obtained by orienting the paths vi1,jP s(vi1,j),vi2,jP s(vi2,j)andvi3,jP s(vi3,j)have the same direction,i.e.from or towards thes(vi,j)’s, while the third one is oriented in the opposite direction, then we can obtain threek-dipaths joining any two ofvi1,j,vi2,j, andvi3,j. Supposee.g. that−−−−−−−−−→

vi1,jP s(vi1,j),−−−−−−−−−→

vi2,jP s(vi2,j)and−−−−−−−−−→

s(vi3,j)P vi3,j are dipaths of−→

GcH. So far, note that there are twok-dipaths starting fromvi1,j andvi2,j, respectively, and ending at vi3,j (whenkis odd, these are obtained by adding−−−−−−−−−−→

s(vi1,j)s(vi3,j)and−−−−−−−−−−→

s(vi2,j)s(vi3,j)toE(−→

GcH)). The lastk-dipath starting fromvi1,j and ending atvi2,j can be obtainede.g. by orienting the edges ofGcHin such a way that−−−−−−−−−→

vi1,jP s0(vi1,j)and−−−−−−−−−→

s0(vi2,j)P vi2,j are dipaths, and−−−−−−−−−−−→

s0(vi1,j)s0(vi2,j)is an arc whenkis odd.

According to Claims 1, 2 and 3, we have an equivalence between finding a proper 2-vertex-colouring ofH and a good orientation ofGcH. Indeed, assume that having the dipath−−−→

uiP u0i (resp. −−−→

u0iP ui) in an orientation ofGcH simulates that vertexxi ofH is coloured blue (resp. red), and that having the dipath

−−−−−−−→

vi,jP s(vi,j)(resp.−−−−−−−→

s(vi,j)P vi,j) simulates the fact that the vertexxiis counted as a blue (resp. red) vertex inEj. Claim 1 reflects the fact that ifxiis coloured, say, blue by a proper 2-vertex-colouring ofH, then xi counts as a blue vertex in every hyperedge which contains it. Claims 2 and 3 depict the fact that all vertices from a single hyperedge ofHcannot have the same colour. Thus, by the discussion following the proof of Claim 3, it can be concluded that from a proper 2-vertex-colouring ofH we can deduce a good orientation ofGcH, and vice-versa.

We now augmentGHwith additional vertices so that there is a path with length at mostkjoining every two non-adjacent vertices ofGcHthat do not form a representative pair. This is done in such a way that there is an orientation of the edges ofE(GH)E(GcH)so that every two vertices ofGHthat do not form

(9)

s3u s2u s1u

p3u p2u p1u u

eu,v

s3v s2v s1v

p3v p2v p1v

v

(a) Casek= 6.

s3u s2u s1u

p3u p2u p1u u

z

s3v s2v s1v

p3v p2v p1v

v

(b) Casek= 7.

Figure 2:The gadgetsGuandGvobtained for a pair{u, v}which is not representative.

a representative pair are joined by a dipath with length at mostk. In this way, the existence of ak-weak orientation ofGHwill only rely on the existence of a good orientation ofGcH.

The augmentation consists in associating a gadgetGvwith each vertexvofGcH, and then connecting all the resulting gadgets in such a way there is a path with length at mostk between any two vertices from different gadgetsGuandGv. In the case where{u, v}is not a representative pair, we add ashortcut betweenGuandGv,i.e. an alternative shorter path for joining two vertices ofGuandGv. This is done in such a way that every vertexu0ofGuis at distance at mostkfrom any vertexv0ofGv, unlessu0 =u, v0 =vand{u, v}is a representative pair. However, in the situation where{u, v}is not representative, there is a path with lengthkjoininguandvthat uses the shortcut betweenGuandGv.

Setx=bk2c. For everyi ∈ {1,2, ..., x}, add two new verticessivandpiv toGv. These two vertices form theithlevelofGv, and are said to bei-vertices. Next, for everyi∈ {1,2, ..., x−1}, add all possible edges between thei- and(i+ 1)-vertices ofGvso that two consecutive levels ofGvform a clique on 4 vertices. Finally, add an edge betweenvand every 1-vertex ofGv.

We finish the construction ofGHby adding some connection between the gadgets. We distinguish two cases depending on the parity ofk:

Ifkis even, then turn the subgraph induced by allx-vertices ofGH into a clique. Next, for every pair{u, v}of vertices ofGcH which is not representative, add a shortcut vertexeu,vto the clique constructed just before. Finally, add every edge betweeneu,vand the vertices from the(x1)th levels ofGuandGvifk4, or the edgesueu,vandeu,vvwhenk= 2.

Otherwise, ifkis odd, then add a new vertexz toGH, and add all possible edges betweenzand x-vertices. For every pair{u, v}ofGcH that is not representative, also add the shortcut edgessxupxv andpxusxvtoGH.

This construction is illustrated in Figure 2 fork= 6andk= 7. Note that no new path with length at mostkjoining two vertices composing a representative pair ofGHarose from the modifications. There- fore, the equivalence between finding a proper 2-vertex-colouring ofH and a good orientation ofGcH is preserved. The last thing to do, is showing that there is an orientation of the edges we have just added so that every pair of vertices ofGHwhich is not representative is joined by ak-dipath in either direction.

Références

Documents relatifs

Using her mind power to zoom in, Maria saw that the object was actually a tennis shoe, and a little more zooming revealed that the shoe was well worn and the laces were tucked under

University of Zurich (UZH) Fall 2012 MAT532 – Representation theory..

[r]

Let (M, J) be a compact, connected almost complex manifold, endowed with the action of a connected compact Lie group G, and let L be a positive G-equivariant line bundle on M.. One

The problem of deciding the existence of a SEPI from G to G’ is NP-complete, but show that when G is fixed, this problem can be decided in constant-time (hint: this

 All together, the points situated in the various middles form an ellipse that you

initialisation (par lecture) des variables d'entrée ; writeln est facultatif, readln indispensable. pas de point virgule avant

We have shown that Problem 1 which is NP-complete for arbitrary graphs be- comes decidable in polynomial time for graphs belonging to any minor-closed family that does not contain