Planar straight-line point-set embedding of trees with partial embeddings

Planar straight-line point-set embedding of trees with partial embeddings

Information Processing Letters 110 (2010) 521–523 Contents lists available at ScienceDirect Information Processing Letters www.elsevier.com/locate/i...

120KB Sizes 3 Downloads 43 Views

Information Processing Letters 110 (2010) 521–523

Contents lists available at ScienceDirect

Information Processing Letters www.elsevier.com/locate/ipl

Planar straight-line point-set embedding of trees with partial embeddings Alireza Bagheri ∗ , Mohammadreza Razzazi Department of Computer Engineering and IT, Amirkabir University of Technology, Tehran, Iran

a r t i c l e

i n f o

a b s t r a c t

Article history: Received 4 February 2010 Received in revised form 14 April 2010 Accepted 25 April 2010 Available online 29 April 2010 Communicated by B. Doerr

Given a set P of n points in the plane, an n-node tree T , and a partial embedding E of T on P (i.e. a planar straight-line point-set embedding of some sub-trees of T on a sub-set of P ), we show that the problem of deciding whether there is a planar straight-line pointset embedding of T on P that includes E is NP-complete. This problem was posed as an open problem in E. Di Giacomo et al. (2009) [8]. © 2010 Elsevier B.V. All rights reserved.

Keywords: Computational geometry Computational complexity Geometric embedding Point-set embedding Constrained graph drawing Partial drawing

1. Introduction Graph drawing is a well-known research field in computational geometry. For a survey on graph drawing see [7]. A point-set embedding of a graph G = ( V , E ) with n vertices on a set P of n points in the plane is a drawing of G such that each vertex of G is represented as a distinct point of P and the edges are polygonal chains. A planar point-set embedding is a crossing-free point-set embedding, and a straight-line point-set embedding is a point-set embedding in which the edges are straight-line segments. Many variations of point-set embedding problems have been investigated in the literature. It was shown in [6, 10] that any outer planar graph has a planar straight-line point-set embedding, assuming the given point set is in general position (no three points being collinear). Efficient algorithms for constructing such an embedding for outer planar graphs and trees are described in [3,4,11,13]. Bipartite embeddings of trees were studied in [1]. It was shown in [12] that any planar graph has a planar embedding on a point set in the plane with at most two

*

Corresponding author. E-mail address: [email protected] (A. Bagheri).

0020-0190/$ – see front matter doi:10.1016/j.ipl.2010.04.019

© 2010

Elsevier B.V. All rights reserved.

bends per edge. If a bijection between the vertices and the point set is fixed, then O (n2 ) bends are needed in total to get a planar embedding of the graph [14,2]. It is shown in [5], that deciding whether there is a planar straight-line embedding of a given planar graph such that its vertices are embedded onto a given point set in the plane is NPcomplete. Drawing graphs with given partial drawings is another variant of the problem that has been investigated in the literature [8,15]. In this problem, drawings of some subgraphs of the graph are already given and the other parts are asked to be drawn. This can be important for example to preserve the user’s mental map of a graph when some certain sub-graphs of the graph do not change over time [8]. Given a planar graph G = ( V , E ) and a planar straight-line partial drawing D of G, it was shown in [15] that it is NP-hard to decide whether G admits a planar straight-line drawing including D. The point-set embedding of trees with partial embedding was investigated in [8]. In this problem, a planar straight-line point-set embedding E of some sub-trees of a tree T on a sub-set of point set P is given. It is asked to find a planar point-set embedding of T on P that includes E and has the minimum number of bends per edge. In [8] lower and upper bounds to the maximum number of

522

A. Bagheri, M. Razzazi / Information Processing Letters 110 (2010) 521–523

Fig. 1. Tree T for the NP-hardness reduction.

bends per edge were provided and the complexity of the problem was posed as an open problem. In this paper we prove that this problem is indeed NP-hard. Theorem 1. Let P be a set of n points in the plane, T be an nnode tree, and E be a planar straight-line point-set embedding of some sub-trees of T on a sub-set of P . Deciding if there exists a straight-line planar point-set embedding of T on P that includes E is NP-complete. 2. NP-completeness proof It is clear that the problem belongs to NP. Given a straight-line planar point-set embedding of T on P that includes E, we can test in polynomial time, in the number of nodes of T , whether the embedding actually is planar. For showing the NP-hardness, we reduce the well-known strongly NP-complete 3-partition problem [9] to our problem. Let B be a natural number, and S be a set of 3n natural numbers ai , 1  i  3n. The set S is more precisely a multiset since duplicate values are allowed. In the 3-partition problem,  it is asked to find n disjoint sub-sets S j ⊂ S, such that a∈ S j a = B for all S j , 1  j  n. Given a 3-partition instance, we construct the tree T as follows.

• For each natural number ai in the input, make a path πi consisting of ai vertices v i, j , 1  j  ai and 1  i  3n.

• Make an additional path π0 consisting of 3n − 1 vertices v 0, j , 1  j  3n − 1. • Add an additional vertex v 0 to T . For each path πi , connect vertex v i ,1 to vertex v 0 , 0  i  3n. Consider an instance of 3-partition problem in which B = 8, n = 3 (3n = 9) and S = {2, 3, 2, 5, 2, 3, 2, 3, 2}. Fig. 1 shows the tree T which is constructed by the above method for this instance of 3-partition. Then, we design a point set P , and a partial embedding E of T on P , such that the embedding of the remaining vertices of T will be possible in a planar straight-line way if and only if the paths πi (i = 0) can be decomposed into groups of exactly B vertices, which is equivalent to the original 3-partition instance. The following point set P and partial embedding E of T will do the job (see Fig. 2):

• Construct the point set P of n( B + 3) points as follows. Add n groups of B points such that point p i , j ,

Fig. 2. Point set P and partial embedding E for the NP-hardness reduction.

which is the jth point of the ith group, has coordinates ((i − 1)( B + 2) + j , 1), where 1  j  B and 1  i  n. Then add three points p 0 , p 0,1 and p 0,3n−1 with coordinates (0, n( B + 2)), (0, 0) and (n( B + 2), 0), respectively. Finally add (n − 1) groups of 3 points p 0,3k+1 , p 0,3k+2 , and p 0,3k+3 with coordinates ( B + 1 + k( B + 2), 0), ( B + 1 + k( B + 2), 2) and ( B + 3 + k( B + 2), 0), respectively, where 0  k  n − 2. • Construct the partial embedding E of T , corresponding to the path π0 as follows. Place v 0 on p 0 , and v 0, j , on p 0, j , where 1  j  3n − 1. The partial embedding E of T is constructed such that the remaining free points are divided into n groups of B points, and the points of each group are invisible from the points of other groups. The only point which is visible from the other points is point p 0 . In this partial embedding vertex v 0 is mapped onto point p 0 . In such an embedding, the vertices of path πi of tree T have to be mapped completely onto the points of just one group, otherwise the path intersects E. Therefore, a planar straight-line pointset embedding of T on P that includes E is possible if and only if paths of T , except π0 , can be arranged in groups such that each group has exactly B vertices. Recall that T has 3n paths in addition to path π0 and vertex v 0 , each path πi , 1  i  n, contains ai vertices, and point set P consists of n groups of B points in addition to point p 0 and the points on which π0 is mapped. Hence, any mapping of T on P , provides a planar straight-line point-set embedding that includes partial embedding E if and only if the 3-partition instance has a solution. 3-partition is NP-hard even when B is bounded by a polynomial in n [9]. The number of vertices of T and the number of points of P are both n( B + 3) which is polynomial in n, assuming B is polynomial in n. The coordinates of the constructed points are integral and also bounded by a polynomial in n. So the whole reduction can be done in polynomial time in n. This finishes the proof of Theorem 1. Although the point set that we have constructed has many collinear points, in the proof we do not use this fact, and

A. Bagheri, M. Razzazi / Information Processing Letters 110 (2010) 521–523

it is easy to modify the reduction to use points which are not collinear. 3. Conclusion In this paper we proved that given a tree T , a point set P and a planar straight-line point-set embedding E of some sub-trees of T , deciding whether there is a planar straight-line point-set embedding of T on P that includes E is NP-complete. If the partial embedding E is removed, then T has always a planar straight-line pointset embedding on P (assuming the points are in general position), and such an embedding can be constructed efficiently [3,4]. References [1] M. Abellanas, J. Garcia-Lopez, G. Hernandez, M. Noy, P.A. Ramos, Bipartite embeddings of trees in the plane, Discrete Appl. Math. 93 (2) (1999) 141–148. [2] M. Badent, E. Di Giacomo, G. Liotta, Drawing colored graphs on colored points, Theoret. Comput. Sci. 408 (2–3) (2008) 129–142. [3] P. Bose, On embedding an outer-planar graph in a point set, Comput. Geom. 23 (3) (2002) 303–312. [4] P. Bose, M. McAllister, J. Snoeyink, Optimal algorithms to embed trees in a point set, J. Graph Algorithms Appl. 1 (2) (1997) 1–15.

523

[5] S. Cabello, Planar embeddability of the vertices of a graph using a fixed point set is NP-hard, J. Graph Algorithms Appl. 10 (2) (2006) 353–363. [6] N. Castaneda, J. Urrutia, Straight line embeddings of planar graphs on point sets, in: Proc. 8th Canadian Conference on Computational Geometry, 1996, pp. 312–318. [7] G. Di Battista, P. Eades, R. Tamassia, I.G. Tollis, Graph Drawing: Algorithms for the Visualization of Graphs, Prentice-Hall, 1999. [8] E. Di Giacomo, W. Didimo, G. Liotta, H. Meijer, S. Wismath, Pointset embeddings of trees with given partial drawings, Comput. Geom. 42 (6–7) (2009) 664–676. [9] M.R. Garey, D.S. Johnson, Computers and Intractability: A Guide to the Theory of NP-Completeness, W.H. Freeman, New York, NY, 1979. [10] P. Gritzmann, B. Mohar, J. Pach, R. Pollack, Embedding a planar triangulation with vertices at specified points, Amer. Math. Monthly 98 (2) (1991) 165–166. [11] Y. Ikebe, M.A. Perles, A. Tamura, S. Tokunaga, The rooted tree embedding problem into points in the plane, Discrete Comput. Geom. 11 (1994) 51–63. [12] M. Kaufmann, R. Wiese, Embedding vertices at points: Few bends suffice for planar graphs, J. Graph Algorithms Appl. 6 (1) (2002) 115– 129. ˝ [13] J. Pach, J. Törocsik, Layout of rooted trees, in: W.T. Trotter (Ed.), Planar Graphs, in: DIMACS Ser., vol. 9, 1993, pp. 131–137. [14] J. Pach, R. Wenger, Embedding planar graphs at fixed vertex locations, Graphs Combin. 17 (2001) 717–728. [15] M. Patrignani, On extending a partial straight-line drawing, Internat. J. Found. Comput. Sci. (Special issue on Graph Drawing) 17 (5) (2006) 1061–1069.