• 沒有找到結果。

Computing the Girth of a Planar Graph in Linear Time

N/A
N/A
Protected

Academic year: 2022

Share "Computing the Girth of a Planar Graph in Linear Time"

Copied!
19
0
0

加載中.... (立即查看全文)

全文

(1)

Computing the Girth of a Planar Graph in Linear Time

Hsien-Chih Chang Hsueh-I Lu April 22, 2013

Abstract

The girth of a graph is the minimum weight of all simple cycles of the graph. We study the problem of determining the girth of an n-node unweighted undirected planar graph.

The first non-trivial algorithm for the problem, given by Djidjev, runs in O(n5/4log n) time.

Chalermsook, Fakcharoenphol, and Nanongkai reduced the running time to O(n log2n).

Weimann and Yuster further reduced the running time to O(n log n). In this paper, we solve the problem in O(n) time.

1 Introduction

Let G be an edge-weighted simple graph, i.e., G does not contain multiple edges and self- loops. We say that G is unweighted if the weight of each edge of G is one. A cycle of G is simple if each node and each edge of G is traversed at most once in the cycle. The girth of G, denoted girth(G), is the minimum weight of all simple cycles of G. For instance, the girth of each graph in Figure 1 is four. As shown by, e.g., Bollob´as [4], Cook [12], Chandran and Subramanian [10], Diestel [14], Erd˝os [21], and Lov´asz [39], girth is a fundamental combinatorial characteristic of graphs related to many other graph properties, including degree, diameter, connectivity, treewidth, and maximum genus. We address the problem of computing the girth of an n-node graph. Itai and Rodeh [28] gave the best known algorithm for the problem, running in time O(M (n) log n), where M (n) is the time for multiplying two n × n matrices [13]. In the present paper, we focus on the case that the input graph is undirected, unweighted, and planar. Djid- jev [16, 17] gave the first non-trivial algorithm for the case, running in O(n5/4log n) time. The min-cut algorithm of Chalermsook, Fakcharoenphol, and Nanongkai [9] reduced the time com- plexity to O(n log2n), using the maximum-flow algorithms of, e.g., Borradaile and Klein [5] or Erickson [22]. Weimann and Yuster [49] further reduced the running time to O(n log n). Linear- time algorithms for an undirected unweighted planar graph were known only when the girth of the input graph is bounded by a constant, as shown by Itai and Rodeh [28], Vazirani and Yannakakis [47], and Eppstein [20]. We give the first optimal algorithm for any undirected unweighted planar graph.

Theorem 1.1. The girth of an n-node undirected unweighted planar graph is computable in O(n) time.

A preliminary version appeared in COCOON 2011 [11].

Email: hchang17@illinois.edu. Department of Computer Science and Information Engineering, National Taiwan University.

Corresponding author. Email: hil@csie.ntu.edu.tw. Web: www.csie.ntu.edu.tw/˜hil. Department of Computer Science and Information Engineering, National Taiwan University. This author also holds joint ap- pointments in the Graduate Institute of Networking and Multimedia and the Graduate Institute of Biomedical Electronics and Bioinformatics, National Taiwan University. Address: 1 Roosevelt Road, Section 4, Taipei 106, Taiwan, ROC. Research supported in part by NSC grants 98–2221–E-002–079–MY3 and 101–2221–E–002–062–MY3.

(2)

2

(a) (c)

2

2 1

1

2 2 1

(b) 2

0 2 1

1 1

2

Figure 1: (a) A planar graph G with nonnegative integral edge weights. (b) The expanded versionEXPAND(G) of G. (c) A contracted graph G0withEXPAND(G0) =EXPAND(G).

Related work. The O(M (n) log n)-time algorithm of Itai and Rodeh [28] also works for directed graphs. The best known algorithm for directed planar graphs, due to Weimann and Yuster [49], runs in O(n3/2) time. The O(n log2n)-time algorithm of Chalermsook et al. [9], using the maximum-flow algorithms of Borradaile and Klein [5] or Erickson [22] also works for undirected planar graphs with nonnegative weights. The recent max-flow algo- rithm of Italiano, Nussbaum, Sankowski, and Wulff-Nilsen [29] improved the running time of Chalermsook et al. to O(n log n log log n). For any given constant k, Alon, Yuster, and Zwick [1] showed that a k-edge cycle of any n-node general graph, if it exists, can be found in O(M (n) log n) time or expected O(M (n)) time. The time complexity was reduced to O(n2) by Yuster and Zwick [50] (respectively, O(n) by Dorn [18]) if k is even (respectively, the input graph is planar). See, e.g., [2, 7, 8, 15, 19, 23, 24, 26, 27, 29, 30, 31, 32, 34, 35, 36, 37, 40, 41, 42, 43, 45, 48] for work related to girths and min-weight cycles in the literature.

Overview. The degree of a graph is the maximum degree of the nodes in the graph. For instance, the number of neighbors of each node in an O(1)-degree graph is bounded by an absolute constant. To compute girth(G0) for the input n-node planar graph G0, we turn G0into an m-node “contracted” (see §2.1) graph G0 with positive integral edge weights such that m ≤ n and girth(G0) = girth(G0), as done by Weimann and Yuster [49]. If the “density” (see §2.1) of G0is Ω(log2m), we can afford to use the algorithm of Chalermsook et al. [9] (see Theorem 2.1) to compute girth(G0). Otherwise, by girth(G0) = O(log2m), as proved by Weimann and Yuster (see Lemma 2.4), and the fact G0has positive integral weights, we can further transform G0to a Θ(m)-node O(log2m)-outerplane graph G with O(1) degree, O(log2m) density, and O(log2m) maximum weight such that girth(G) = girth(G0). The way we reduce the “outerplane radius”

(see §2.2) is similar to those of Djidjev [17] and Weimann and Yuster [49]. In order not to increase the outerplane radius, our degree-reduction operation (see §2.2) is different from that of Djidjev [17]. Although G may have zero-weight edges and may no longer be contracted, it does not affect the correctness of the following approach for computing girth(G).

A cycle of a graph is non-degenerate if some edge of the graph is traversed exactly once in the cycle. Let u and v be two distinct nodes of G. Let g(u, v) be the minimum weight of any simple cycle of G that contains u and v. Let d(u, v) be the distance of u and v in G. For any edge e of G, let d(u, v; e) be the distance of u and v in G \ {e}. If e(u, v) is an edge of some min-weight path between u and v in G, then d(u, v) + d(u, v; e(u, v)) is the minimum weight of any non-degenerate cycle containing u and v that traverses e(u, v) exactly once. In general, d(u, v) + d(u, v; e(u, v)) could be less than g(u, v). However, if u and v belong to a min-weight simple cycle of G, then d(u, v) + d(u, v; e(u, v)) = g(u, v) = girth(G).

Computing the minimum d(u, v) + d(u, v; e(u, v)) over all pairs of nodes u and v in G is too expensive. However, computing d(u, v)+d(u, v; e(u, v)) for all pairs of nodes u and v in a small node set S of G leads to a divide-and-conquer procedure for computing girth(G). Specifically, since G is an O(log2m)-outerplane graph, there is an O(log2m)-node set S of G partitioning

(3)

V (G) \ S into two non-adjacent sets V1and V2with roughly equal sizes. Let C be a min-weight simple cycle of G. Let G1 (respectively, G2) be the subgraph of G induced by V1∪ S (respec- tively, V2∪S). If V (C)∩S has at most one node, the weight of C is the minimum of girth(G1) and girth(G2). Otherwise, the weight of C is the minimum d(u, v)+d(u, v; e(u, v)) over all O(log4m) pairs of nodes u and v in S. Edges e(u, v) and distances d(u, v) and d(u, v; e(u, v)) in G can be obtained via dynamic programming from edges e(u, v) and distances d(u, v) and d(u, v; e(u, v)) in G1 and G2 for any two nodes u and v in an O(log3m)-node superset “Border(S)” (see §4) of S. The above recursive procedure (see Lemma 5.4) is executed for two levels. The first level (see the proofs of Lemmas 3.1 and 5.4) reduces the girth problem of G to girth and dis- tance problems of graphs with O(log30m) nodes. The second level (see the proofs of Lem- mas 5.6 and 6.1) further reduces the problems to girth and distance problems of graphs with O((log log m)30) nodes, each of whose solutions can thus be obtained directly from an O(m)- time pre-computable data structure (see Lemma 5.5). Just like Djidjev [17] and Chalermsook et al. [9], we rely on dynamic data structures for planar graphs. Specifically, we use the dynamic data structure of Klein [33] (see Lemma 5.2) that supports point-to-point distance queries. We also use Goodrich’s decomposition tree [25] (see Lemma 4.2), which is based on the link-cut tree of Sleator and Tarjan [46]. The interplay among the densities, outerplane radii, and max- imum weights of subgraphs of G is crucial to our analysis. Although it seems unlikely to complete these two levels of reductions in O(m) time, we can fortunately bound the overall time complexity by O(n).

The rest of the paper is organized as follows. Section 2 gives the preliminaries and reduces the girth problem on a general planar graph to the girth problem on a graph with O(1) degree and poly-logarithmic maximum weight, outerplane radius, and density. Section 3 gives the framework of our algorithm, which consists of three tasks. Section 4 shows Task 1. Section 5 shows Task 2. Section 6 shows Task 3. Section 7 concludes the paper.

2 Preliminaries

All logarithms throughout the paper are to the base of two. Unless clearly specified otherwise, all graphs are undirected simple planar graphs with nonnegative integral edge weights. Let |S|

denote the cardinality of set S. Let V (G) consist of the nodes of graph G. Let E(G) consist of the edges of graph G. Let |G| = |V (G)| + |E(G)|. By planarity of G, we have |G| = Θ(|V (G)|).

Let wmax(G) denote the maximum edge weight of G. For instance, if G is as shown in Fig- ures 1(a) and 1(b), then wmax(G) = 2 and wmax(G) = 1, respectively. Let w(G) denote the sum of edge weights of graph G. Therefore, girth(G) is the minimum w(C) over all simple cycles C of G.

Theorem 2.1 (Chalermsook et al. [9]). If G is an m-node planar graph with nonnegative weights, then it takes O(m log2m) time to compute girth(G).

2.1 Expanded version, density, weight decreasing, and contracted graph

The expanded version of graph G, denotedEXPAND(G), is the unweighted graph obtained from G by the following operations: (1) For each edge (u, v) with positive weight k, we replace edge (u, v) by an unweighted path (u, u1, u2, . . . , uk−1, v); and (2) for each edge (u, v) with zero weight, we delete edge (u, v) and merge u and v into a new node. For instance, the graph in Figure 1(b) is the expanded version of the graphs in Figures 1(a) and 1(c). One can verify that

(4)

the expanded version of G has w(G) − |E(G)| + |V (G)| nodes. Define the density of G to be

density(G) = |V (EXPAND(G))|

|V (G)| .

For instance, the densities of the graphs in Figures 1(a) and 1(c) are32 and 95, respectively.

Lemma 2.2. The following statements hold for any graph G.

1. girth(EXPAND(G)) = girth(G).

2. density(G) can be computed from G in O(|G|) time.

For any number w, letDECR(G, w) be the graph obtainable in O(|G|) time from G by de- creasing the weight of each edge e with w(e) > w down to w. The following lemma is straight- forward.

Lemma 2.3. If G is a graph and w is a positive integer, then density(DECR(G, w)) ≤ density(G).

Moreover, if w ≥ girth(G), then girth(DECR(G, w)) = girth(G).

A graph is contracted if the two neighbors of any degree-two node of the graph are adjacent in the graph. For instance, the graphs in Figures 1(a) and 1(b) are not contracted and the graph in Figure 1(c) is contracted.

Lemma 2.4 (Weimann and Yuster [49, Lemma 3.3]).

1. Let G0 be an n-node unweighted biconnected planar graph. It takes O(n) time to compute an m-node biconnected contracted planar graph G with positive integral weights such that m ≤ n and G0 =EXPAND(G).

2. If G is a biconnected contracted planar graph with positive integral weights, then we have that girth(G) ≤ 36 · density(G).

2.2 Outerplane radius and degree reduction

A plane graph is a planar graph equipped with a planar embedding. A node of a plane graph is external if it is on the outer face of the embedding. The outerplane depth of a node v in a plane graph G, denoted depthG(v), is the positive integer such that v becomes external after peeling depthG(v)−1 levels of external nodes from G. The outerplane radius of G, denoted orad(G), is the maximum outerplane depth of any node in G. A plane graph G is r-outerplane if orad(G) ≤ r.

For instance, in the graph shown in Figure 1(a), the outerplane depth of the only internal node is two, and the outerplane depths of the other five nodes are all one. The outerplane radius of the graph in Figure 1(a) is two and the outerplane radius of the graph in Figure 1(c) is one. All three graphs in Figure 1 are 2-outerplane. The graph in Figure 1(c) is also 1-outerplane.

Let v be a node of plane graph G with degree d ≥ 4. Let u1 be a neighbor of v in G. For each i = 2, 3, . . . , d, let ui be the i-th neighbor of v in G starting from u1 in clockwise order around v. LetREDUCE(G, v, u1) be the plane graph obtained from G by the following steps, as illustrated by Figure 2: (1) adding a zero-weight path (v1, v2, . . . , vd), (2) replacing each edge (ui, v) by edge (ui, vi) with w(ui, vi) = w(ui, v), and (3) deleting node v.

Lemma 2.5. Let v be a node of plane graph G with degree four or more. If u1 is a neighbor of v with the smallest outerplane depth in G, then

1. REDUCE(G, v, u1) can be obtained from G in time linear in the degree of v in G,

(5)

4

v4

v6 v3

v5

v2 u1

v7

u4

u5

u6 u3

u7 u2

u1

u4

u5

u7 u2

u3

u6

v 6

3

7

4 5

0

0 0 0

0 0

2 3

7

2 1

6

1 5

v1

Figure 2: The operation that turns a plane graph G intoREDUCE(G, v, u1).

2. EXPAND(REDUCE(G, v, u1)) =EXPAND(G), and 3. orad(REDUCE(G, v, u1)) = orad(G).

Proof. The first two statements are straightforward. To prove the third statement, let j = depthG(v) and G0 = REDUCE(G, v, u1). Let G00 be the plane graph obtained from G0 by peel- ing j − 1 levels of external nodes. By the choice of u1, each vi with 1 ≤ i ≤ d is an external node in G00. Therefore, for each i = 1, 2, . . . , d, we have depthG0(vi) = j. Since the plane graphs obtained from G andREDUCE(G, v, u1) by peeling j levels of external nodes are identical, the lemma is proved.

2.3 Proving the theorem by the main lemma

This subsection shows that, to prove Theorem 1.1, it suffices to ensure the following lemma.

Lemma 2.6. If G is an O(1)-degree plane graph satisfying the following equation

wmax(G) + orad(G) = O(density(G)) = O(log2|G|), (1) then girth(G) can be computed from G in O(|G| + |EXPAND(G)|) time.

Now we prove Theorem 1.1.

Proof of Theorem 1.1. Assume without loss of generality that the input n-node graph G0 is bi- connected. Let G be an m-node biconnected contracted planar graph withEXPAND(G) = G0 and m ≤ n that can be computed from G0 in O(n) time, as ensured by Lemma 2.4(1). By Lemma 2.2(1), girth(G) = girth(G0). If n > m log2m, by Theorem 2.1, it takes O(m log2m) = O(n) time to compute girth(G). The theorem is proved. The rest of the proof assumes m ≤ n ≤ m log2m.

We first equip the m-node graph G with a planar embedding, which is obtainable in O(m) time (see, e.g., [6]). Initially, we have |V (G)| = m, |V (EXPAND(G))| = n, and density(G) =

mn = O(log2m). We update G in three O(m + n)-time stages which maintain |V (G)| = Θ(m),

|V (EXPAND(G))| = Θ(n), girth(G) = girth(G0), and the planarity of G. At the end of the third stage, G may contain zero-weight edges and may no longer be biconnected and contracted.

However, the resulting G is of degree at most three, has nonnegative weights, and satisfies Equation (1). The theorem then follows from Lemma 2.6.

Stage 1: Bounding the maximum weight of G. We repeatedly replace G by DECR(G, d36 · density(G)e) until wmax(G) ≤ d36 · density(G)e holds. Although density(G) may change in each iteration of the weight decreasing, by Lemmas 2.3 and 2.4(2) we know that girth(G) remains the same and density(G) does not increase. Since G remains biconnected and contracted and

(6)

L 4

1 2 3

8

6 7

12

9 10 1011 2

10 1

2 2

2 2

1

2

22 2 2

1 1 1

(a)

2 8

7

10 10 2

1 2

2

2 2

1 1

(c) 12

11 3

4

(b) 2 2

2 7

7 8

7

7 8

7 8 10

10 10

10 10

S 5

1 5 6

5 9 4

3

12 5 11

Figure 3: (a) A weighted plane graph G. (b) A dissection tree T of G with S = {7, 8} and Border(S) = {2, 7, 8, 10}. (c) Graph G[Below(S)].

has positive weights, Lemma 2.4(2) ensures girth(G) ≤ 36·density(G) throughout the stage. Af- ter the first iteration, wmax(G) ≤ d36 ·mne. Each of the following iterations decreases wmax(G) by at least one. Therefore, this stage has O(mn) iterations, each of which takes O(m) time, by Lemma 2.2(2). The overall running time is O(n). The resulting m-node graph G satisfies wmax(G) = O(density(G)) = O(log2|G|).

Stage 2: Bounding the outerplane radius of G. For each positive integer j, let Vj consist of the nodes with outerplane depths j in G. For each integer i ≥ 0, let Gi be the plane subgraph of G induced by the union of Vj with 36 · i · density(G) < j ≤ 36 · (i + 2) · density(G). Let G0 be the plane graph formed by the disjoint union of all the plane subgraphs Gi such that the external nodes of each Gi remain external in G0. We have orad(G0) = O(density(G)). Each cycle of G0 is a cycle of G, so girth(G) ≤ girth(G0). By Lemma 2.4(2), we have girth(G) ≤ 36 · density(G). Since the weight of each edge of G is at least one, the overlapping of the subgraphs Gi in G ensures that any cycle C of G with w(C) = girth(G) lies in some subgraph Gi of G, implying girth(G) ≥ girth(G0). Therefore, girth(G0) = girth(G). By |V (G0)| = Θ(|V (G)|) and

|V (EXPAND(G0))| = Θ(|V (EXPAND(G))|), we have density(G0) = Θ(density(G)). We replace G by G0. The resulting G satisfies girth(G) = girth(G0) and Equation (1).

Stage 3: Bounding the degree of G. For each node v of G with degree four or more, we find a neighbor u of v in G whose outerplane depth in G is minimized, and then replace G by

REDUCE(G, v, u). By Lemma 2.5(1), this stage takes O(m) time. At the end, the degree of G is at most three. By Lemma 2.5(2), the expanded version of the resulting G is identical to that of the G at the beginning of this stage. By Lemma 2.5(3), the outerplane radius remains the same. The number of nodes in G increases by at most a constant factor. The maximum weight remains the same. Therefore, the resulting G satisfies Equation (1). By Lemma 2.2(1), we have girth(G) = girth(G0).

The rest of the paper proves Lemma 2.6.

3 Framework: dissection tree, nonleaf problem, and leaf problem

This section shows the framework of our proof for Lemma 2.6. Let G[S] denote the subgraph of G induced by node set S. Let T be a rooted binary tree such that each member of V (T ) is a subset of V (G). To avoid confusion, we use “nodes” to specify the members of V (G) and “vertices” to specify the members of V (T ). Let Root(T ) denote the root vertex of T . Let Leaf(T ) consist of the leaf vertices of T . Let Nonleaf(T ) consist of the nonleaf vertices of T . For

(7)

each vertex S of T , let Below(S) denote the union of the vertices in the subtree of T rooted at S. Therefore, if S is a leaf vertex of T , then Below(S) = S. Also, Below(Root(T )) consists of the nodes of G that belong to some vertex of T . For each nonleaf vertex S of T , let Lchild(S) and Rchild(S) denote the two children of S in T . Therefore, if S is a nonleaf vertex of T , then Below(S) = S ∪ Below(Lchild(S)) ∪ Below(Rchild(S)). For instance, let T be the tree in Figure 3(b). We have Root(T ) = {2, 7, 10}. Let S = Rchild(Root(T )). We have S = {7, 8} and Below(S) = {2, 3, 4, 7, 8, 10, 11, 12}. Let L = Lchild(S). We have L = Below(L) = {2, 3, 4, 7, 8}.

Node sets V1 and V2are dissected by node set S in G if any node in V1\ S and any node in V2\ S are not adjacent in G. We say that T is a dissection tree of G if the following properties hold.

• Property 1: Below(Root(T )) = V (G).

• Property 2: The following statements hold for each nonleaf vertex S of T . (a) S ⊆ Below(Lchild(S)) ∩ Below(Rchild(S)).

(b) Below(Lchild(S)) and Below(Rchild(S)) are dissected by S in G.

For instance, Figure 3(b) is a dissection tree of the graph in Figure 3(a).

For any subset S of V (G), any two distinct nodes u and v of S, and any edge e of G, let dS(u, v; e) denote the distance of u and v in G[Below(S)] \ {e} and let dS(u, v) denote the distance of u and v in G[Below(S)]. Observe that if eS(u, v) is an edge in some min-weight path between u and v in G[Below(S)], then dS(u, v) + dS(u, v; eS(u, v)) is the minimum weight of any non-degenerate cycle in G[Below(S)] containing u and v that traverses eS(u, v) exactly once. For instance, let G and T be shown in Figure 3(a) and 3(b). If S = {7, 8}, then G[Below(S)]

is as shown in Figure 3(c). We have dS(7, 10) = 7 (e.g., path (7, 8, 12, 11, 10) has weight 7) and dS(7, 10; (7, 8)) = 10 (e.g., path (7, 3, 4, 8, 12, 11, 10) has weight 10). Since (7, 8) is an edge in a min-weight path (7, 8, 12, 11, 10) between nodes 7 and 10, the minimum weight of any non- degenerate cycle in G[Below(S)] containing nodes 7 and 10 that traverses (7, 8) exactly once is 17 (e.g., non-degenerate cycle (7, 8, 12, 11, 10, 11, 12, 8, 4, 3, 7) has weight 17 and traverses (7, 8) exactly once).

Definition 3.1. For any dissection tree T of graph G, the nonleaf problem of (G, T ) is to compute the following information for each nonleaf vertex S of T and each pair of distinct nodes u and v of S: (1) an edge eS(u, v) in a min-weight path between u and v in G[Below(S)] and (2) distances dS(u, v) and dS(u, v; eS(u, v)).

Definition 3.2. For any dissection tree T of graph G, the leaf problem of (G, T ) is to compute the minimum girth(G[L]) over all leaf vertices L of T .

Define the sum of squares of a dissection tree T as squares(T ) = X

S∈Nonleaf(T )

|S|2.

Our proof for Lemma 2.6 consists of the following three tasks.

Task 1. Computing a dissection tree T of G with squares(T ) = O(|G|).

Task 2. Solving the nonleaf problem of (G, T ).

Task 3. Solving the leaf problem of (G, T ).

(8)

The following lemma ensures that, to prove Lemma 2.6, it suffices to complete all three tasks in O(|G| + |EXPAND(G)|) time for any O(1)-degree plane graph G satisfying Equation (1).

Lemma 3.1. Given a dissection tree T of graph G and solutions to the leaf and nonleaf problems of (G, T ), it takes O(squares(T )) time to compute girth(G).

Proof. Let gleaf be the given solution to the leaf problem of (G, T ). It takes O(squares(T )) time to compute the minimum value gnonleaf of dS(u, v) + dS(u, v; eS(u, v)) over all pairs of distinct nodes u and v of S, where eS(u, v) is the edge in the given solution to the non- leaf problem of (G, T ). Let C be a simple cycle of G with w(C) = girth(G). It suffices to show w(C) = min{gleaf, gnonleaf}. By Property 1 of T , there is a lowest vertex S of T with V (C) ⊆ Below(S). If S is a leaf vertex of T , then w(C) = gleaf. If S is a nonleaf vertex of T , then w(C) = girth(G[Below(S)]). We know |S ∩ V (C)| ≥ 2: Assume |S ∩ V (C)| ≤ 1 for contradiction.

By Property 2b and simplicity of C, we have V (C) ⊆ S ∪ Lchild(S) or V (C) ⊆ S ∪ Rchild(S).

By Property 2a, either V (C) ⊆ Lchild(S) or V (C) ⊆ Rchild(S) holds, contradicting the choice of S. Let u and v be two distinct nodes in S ∩ V (C). Since C is a min-weight non-degenerate cycle of G[Below(S)], we have w(C) = dS(u, v) + dS(u, v; eS(u, v)). Therefore, w(C) = gnonleaf. The lemma is proved.

4 Task 1: computing a dissection tree

Let T be a dissection tree of graph G. For each vertex S of T , let Above(S) be the union of the ancestors of S in T and let Inherit(S) = Above(S) ∩ Below(S). If S is a leaf vertex of T , then let Border(S) = Inherit(S). If S is a nonleaf vertex of T , then let Border(S) = S ∪ Inherit(S).

For instance, let T be as shown in Figure 3(b). Let S = Rchild(Root(T )). We have Above(S) = Inherit(S) = {2, 7, 10} and Border(S) = {2, 7, 8, 10}. Let L = Lchild(S). We have Above(L) = {2, 7, 8, 10} and Inherit(L) = Border(L) = {2, 7, 8}. Define

`(m) = dlog30me.

For any positive integer r, a dissection tree T of an m-node graph G is an r-dissection tree of G if the following conditions hold.

• Condition 1: |V (T )| = O(m/`(m)) andP

L∈Leaf(T )|Border(L)| = O(mr/`(m)).

• Condition 2: |L| = Θ(`(m)) and |Border(L)| = O(r log m) hold for each leaf vertex L of T .

• Condition 3: |S| + |Border(S)| = O(r log m) hold for each nonleaf vertex S of T .

For any r-outerplane G, it takes O(m) time to compute an O(r)-node set S of G such that the node subsets V1 and V2 of G dissected by S satisfy |V1|/|V2| = Θ(1) (see, e.g., [3, 44]).

By recursively applying this linear-time procedure, an r-dissection tree can be obtained in O(m log m) time, which is too expensive for our algorithm. Instead, based upon Goodrich’s O(m)-time separator decomposition [25], we prove the following lemma.

Lemma 4.1. Let G be an m-node r-outerplane O(1)-degree graph with r = O(log2m). It takes O(m) time to compute an r-dissection tree of G.

Let T0 be a rooted binary tree such that each vertex of T0 is a subset of V (G). We say that T0is a decomposition tree of G if Properties 1 and 2b hold for T0. For instance, Figure 4(b) shows a decomposition tree of the graph in Figure 4(a). For any m-node triangulated plane graph ∆ and for any positive integer ` ≤ m, Goodrich [25] showed that it takes O(m) time to compute

(9)

7 8 7

6 7

5 9

4 7 8

7 8 10

11 10 10

10 10

12

(b) (c)

(a)

1 5 9

10 6 2

3 7 11

12 8

4 2

5

5 8

1 6

9 3

4

11 12 10

2 3 1 2

2 7

5

Figure 4: (a) A plane graph G. (b) A decomposition tree T0of G. (c) A dissection tree T of G.

an O(m/`)-vertex O(log m)-height decomposition tree T0 of ∆ such that |L| = Θ(`) holds for each leaf vertex L of T0and |S| = O(|Below(S)|0.5) holds for nonleaf vertex S of T0. As a matter of fact, Goodrich’s techniques directly imply that if an O(r)-diameter spanning tree of ∆ is given, then a decomposition tree T0 of ∆ satisfying the following four conditions can also be obtained efficiently.

• Condition 1’: |V (T0)| = O(m/`(m)).

• Condition 2’: |L| = Θ(`(m)) and |Border(L)| = 0 hold for each leaf vertex L of T0.

• Condition 3’: |S| = |Border(S)| = O(r) holds for each nonleaf vertex S of T0.

• Condition 4’: The height of T0is O(log m).

Lemma 4.2. Given an O(r)-diameter spanning tree of an m-node simple triangulated plane graph

∆ with r = O(log2m), it takes O(m) time to compute a decomposition tree T0 of ∆ that satisfies Properties 1 and 2b and Conditions 1’, 2’, 3’, and 4’.

Proof. The lemma can be proved by following what Goodrich did in [25], so we give only a proof sketch here. Goodrich [25, §2.4] showed that, with some O(m)-time pre-computable dy- namic data structures for the given O(r)-diameter spanning tree and ∆, it takes O(r logO(1)m) time to find a fundamental cycle C of ∆ with respect to the given spanning tree such that the maximum number of nodes either inside or outside C is minimized. Since the diameter of the given spanning tree is O(r), we have |C| = O(r). Let V1 (respectively, V2) consist of the nodes of ∆ inside (respectively, outside) C. We have |V1|/|V2| = Θ(1), as shown by Lipton and Tarjan [38]. With the pre-computed data structures, it also takes O(r logO(1)m) time to (1) split ∆ into ∆[V1] and ∆[V2] and (2) split the given O(r)-diameter spanning tree of ∆ into an O(r)-diameter spanning tree of ∆[V1] and an O(r)-diameter spanning tree of ∆[V2]. Let T0 be obtained by recursively computing O(r)-node sets Lchild(S) and Rchild(S) of ∆[V1] and ∆[V2] until |S| ≤ `(m). As long as r = O(m1−²) holds for some constant ² > 0, the overall running time is O(m). One can verify that the resulting tree T0 indeed satisfies Properties 1 and 2b and Conditions 1’, 2’, 3’, and 4’.

We prove Lemma 4.1 using Lemma 4.2.

Proof of Lemma 4.1. It takes O(m) time to triangulate the m-node r-outerplane graph G into an m-node simple triangulated plane graph ∆ that admits a spanning tree with diameter O(r).

Specifically, we first triangulate each connected component of G into a simple biconnected internally triangulated plane graph G0 such that the outerplane depth of each node remains

(10)

2 2

(a) 1

1

2 2

2

(b) 1

1

1 1

1 1

2 2

2 2

2 2

(c) 1

1

1

2 2

2 2

2 u0

Figure 5: (a) A plane graph G. Each node is labeled by its outerplane depth. (b) A biconnected internally triangulated plane graph G0 obtained from G. (c) A triangulated plane graph ∆ obtained from G0with a spanning tree of ∆ rooted at u0.

the same after the triangulation. Let u0 be an arbitrary external node of G0. We then add an edge (u0, u) for each external node u of G0that is not adjacent to u0. The resulting graph ∆ is an m-node O(r)-outerplane simple triangulated plane graph. An O(r)-diameter spanning tree of

∆ can be obtained in O(m) time as follows. Let u0be the parent of all of its neighbors in ∆. For each node u other than u0 and the neighbors of u0, we arbitrary choose a neighbor v of u in ∆ with depth(v) = depth(u) − 1 and let v be the parent of u in the spanning tree. The diameter of the resulting spanning tree of ∆ is O(r). For instance, let G be as shown in Figure 5(a). An example of G0is shown in Figure 5(b). An example of ∆ together with its spanning tree rooted at u0is shown in Figure 5(c).

Let T0 be a decomposition tree of ∆ as ensured by Lemma 4.2. Since ∆ is obtained from G by adding edges, T0 is also a decomposition tree of G that satisfies Properties 1 and 2b and Conditions 1’, 2’, 3’, and 4’. We prove the lemma by showing that T0 can be modified in O(m) time into an r-dissection tree T of G by callingDESCEND(Root(T0)), where the recursive procedureDESCEND(S) is defined as follows. If S is a leaf vertex of T0, then we return. If S is a nonleaf vertex of T0, we first (1) run the following steps for each node u of the current S, and then (2) recursively callDESCEND(Lchild(S)) andDESCEND(Rchild(S)).

Step 1. If u is not adjacent to any node in the current Below(Lchild(S)) in G, then we delete u from S and insert u into the current Rchild(S).

Step 2. If u is adjacent to some node in the current Below(Lchild(S)) in G and is not adjacent to any node in the current Below(Rchild(S)) in G, then we delete u from S and insert u into the current Lchild(S).

Step 3. If u is adjacent to some node in the current Below(Lchild(S)) and some node in the cur- rent Below(Rchild(S)) in G, then we leave u in S and insert u into the current Lchild(S) and Rchild(S).

For instance, if the decomposition tree T0 is as shown in Figure 4(b), then the resulting tree T of runningDESCEND(Root(T0)) is as shown in Figure 4(c).

We show that T is indeed an r-dissection tree of G. By definition ofDESCEND, one can verify that a node u belongs to a nonleaf vertex S of T if and only if u belongs to both Below(Lchild(S)) and Below(Rchild(S)) in T . Property 2a holds for T and, thereby, Properties 1 and 2 of T follow from Properties 1 and 2b of T0. Moreover, if u belongs to a nonleaf vertex S of T , then the degrees of u in G[Below(Lchild(S))] and G[Below(Rchild(S))] are strictly less than the degree of u in G[Below(S)]. Since the degree of G is O(1), each node u of G belongs to O(1) vertices

(11)

of T . By Conditions 1’ and 3’ of T0, we haveP

L∈Leaf(T )|Border(L)| = P

S∈Nonleaf(T0)O(|S|) = O(mr/`(m)) and |V (T )| = |V (T0)| = O(m/`(m)). Condition 1 of T holds. By Conditions 3’

and 4’ of T0, the procedure increases |S| and |Border(S)| for each vertex S of T0 by O(r log m).

Therefore, Conditions 2 and 3 of T follow from Conditions 2’ and 3’ of T0.

We show that T can be obtained from T0 in O(m) time. We first spend O(m) time to com- pute for each node v of G a list of O(1) vertices of the original T0 that contain v. Consider the case that S is a nonleaf vertex of the current T0. Let S0 be a child vertex of S in the current T0. To determine whether a node u of S is adjacent to some node in the current Below(S0), for all O(1) neighbors v of u in G, we traverse upward in T0from the O(1) vertices of T0 that currently contain v. The traversal passes S0 if and only if u is adjacent to some node in the current Below(S0). By Condition 4’ of T0, it takes O(log m) time to determine whether u is ad- jacent to the current Below(S0). Each update to the list of vertices of T0 that contains u takes O(1) time. By Conditions 1’, 3’, and 4’ of T0, the overall running time ofDESCEND(Root(T0)) is O(mr log2m/`(m)) = O(m). The lemma is proved.

5 Task 2: solving the nonleaf problems

This section proves the following lemma.

Lemma 5.1. Let G be an m-node O(1)-degree r-outerplane graph with wmax(G) + r = O(log2m).

Given an r-dissection tree T of G, the nonleaf problem of (G, T ) can be solved in O(mr) time.

Definition 5.1. Let T be a dissection tree of G. Let S be a vertex of T . The border problem of (G, T ) for S is to compute the following information for any two distinct nodes u and v of Border(S): (1) dS(u, v), (2) an edge eS(u, v) on some min-weight path between u and v in G[Below(S)] that is incident to u, and (3) dS(u, v; e) for each edge e of G incident to u.

Since S ⊆ Border(S) holds for each nonleaf vertex S of T , any collection of solutions to the border problems of (G, T ) for all nonleaf vertices of T yields a solution to the nonleaf problem of (G, T ). We prove Lemma 5.1 by solving the border problems of (G, T ) for all vertices of T in O(mr) time. A leaf vertex L in an r-dissection tree T of an m-node graph G is special if

|Border(L)| + r ≤ dlog2`(m)e.

Section 5.1 shows that the border problems of (G, T ) for all vertices of T can be reduced in O(mr) time to the border problems of (G, T ) for all special leaf vertices of T , as summarized by Lemma 5.4. Section 5.2 shows that the border problems of (G, T ) for all special leaf vertices of T can be solved in O(mr) time, as summarized by Lemma 5.6. Lemma 5.1 follows immediately from Lemmas 5.4 and 5.6.

5.1 A reduction to the border problems for the special leaf vertices

Our reduction uses the following dynamic data structure that supports distance queries.

Lemma 5.2 (Klein [33]). Let G be an `-node planar graph. It takes O(` log2`) time to compute a data structure Oracle(G) such that each update to the weight of an edge and each query to the distance between any two nodes in G can be supported by Oracle(G) in time O(`2/3log5/3`) = O(`7/10).

The following lemma is needed to ensure the correctness of our reduction via dynamic programming.

(12)

Lemma 5.3. For each nonleaf vertex S of T , we have S ⊆ Border(Lchild(S)) ∩ Border(Rchild(S)) and Border(S) ⊆ Border(Lchild(S)) ∪ Border(Rchild(S)).

Proof. Let S0 = Lchild(S) and S00= Rchild(S). By Property 2a of T , S ⊆ Below(S0) ∩ Below(S00).

By S ⊆ Above(S0)∩Above(S00), we have S ⊆ Inherit(S0)∩Inherit(S00). By Inherit(S0) ⊆ Border(S0) and Inherit(S00) ⊆ Border(S00), we have S ⊆ Border(S0) ∩ Border(S00). We also have

Inherit(S) \ S = ((Below(S0) ∪ Below(S00) ∪ S) ∩ Above(S)) \ S

⊆ (Below(S0) ∪ Below(S00)) ∩ Above(S)

= (Below(S0) ∩ Above(S)) ∪ (Below(S00) ∩ Above(S))

⊆ (Below(S0) ∩ Above(S0)) ∪ (Below(S00) ∩ Above(S00))

= Inherit(S0) ∪ Inherit(S00)

⊆ Border(S0) ∪ Border(S00).

Thus, Border(S) = S ∪ (Inherit(S) \ S) ⊆ Border(S0) ∪ Border(S00). The lemma is proved.

The following lemma shows the reduction.

Lemma 5.4. Let G be an m-node O(1)-degree graph. Given (1) an r-dissection tree T of G with r = O(log2m) and (2) solutions to the border problems of (G, T ) for all special leaf vertices of T , it takes O(mr) time to solve the border problems of (G, T ) for all vertices of T .

Proof. Solutions for special leaf vertices are given. We first show that it takes O(mr) time to compute solutions for all non-special leaf vertices L of T . Let ` = `(m). By Condition 1 of T , we haveP

L∈Leaf(T )(|Border(L)| + r) = O(mr/`), implying that T has O(` logmr2`) non-special leaf vertices. For each non-special leaf vertex L of T , we run the following O(` log2`)-time steps.

Step 1. By Condition 2 of T , we have |L| = Θ(`). We compute a data structure Oracle(G[L]) in O(` log2`) time as ensured by Lemma 5.2.

Step 2. For any two nodes u and v in Border(L), we first obtain dL(u, v) from Oracle in O(`7/10) time. We then find a neighbor x of u in G[L] with dL(u, v) = w(u, x) + dL(x, v) and let eL(u, v) = (u, x), which can be obtained from Oracle in O(`7/10) time, since the degree of G is O(1). By Lemma 5.2 and Condition 2 of T , the overall time complexity for this step is O(`7/10· |Border(L)|2) = O(`7/10· r2log2m) = O(`9/10).

Step 3. For each edge e that is incident to Border(L), we compute dL(u, v; e) from Oracle for all nodes u and v of Border(L) as follows: (1) Temporarily setting w(e) = ∞; (2) for each pair of distinct nodes u and v in Border(L), obtaining dL(u, v; e) from the distance of u and v in the current G[L]; and (3) restoring the original weight of e. Since the degree of G is O(1), there are O(|Border(L)|) choices of e. By Lemma 5.2 and Condition 2 of T , the running time of this step is O(`7/10· |Border(L)|3) = O(`7/10· r3log3m) = O(`).

We now show that the solutions for all nonleaf vertices S of T can be computed in O(m) time. By definition of `(m) and Condition 1 of T , we have |Nonleaf(T )| = O(m/ log30m). By r = O(log2m) and Condition 3 of T , we have |S| + |Border(S)| = O(log3m). It suffices to prove the following claim for each nonleaf vertex S of T : “Given solutions for S0 = Lchild(S) and S00 = Rchild(S), a solution for S can be computed in O(|Border(S)|3 · |S|2) time.” By Property 2b of T , Below(S0) and Below(S00) are dissected by S in G. We use (S, k)-path to denote a path of G[Below(S)] that switches to a different side of S at most k times: Precisely, an (S, 0)-path is a path that completely lies in G[Below(S0)] or completely lies in G[Below(S00)].

(13)

L 2

2 7

7 8

7

7 8

7 8 10

10 10

10 10

S R

5

1 5 6

5 9 4

3

12 11

2 7

10 10 2

10 1

2 2

2 2

1

2

2 2 2 2

1 1 1 4

3

8 12

11

9 6

5 1

2 8

7

10 10 2

1 2

2

2 2

1 1

(c) 3

4 12

11

(a) (b)

2

Figure 6: (a) A dissection tree T of the graph in (b) with R = Border(R) = {2, 7, 10}, S = {7, 8}, and Border(S) = {2, 7, 8, 10}. (b) Graph G = G[Below(R)]. (c) Graph G[Below(S)].

For any positive integer k, we say that (u1, u2, . . . , ut) is an (S, k)-path if (u1, u2, . . . , ut0) is an (S, k − 1)-path, where t0is the smallest integer such that (ut0, ut0+1, . . . , ut) is an (S, 0)-path. For instance, let T and G be as shown in Figures 6(a) and 6(b). Let S = {7, 8}. Note that (8, 7, 11, 10) is both an (S, 0)-path and an (S, 1)-path with ut0 = 8. However, (2, 3, 7, 11, 10) is an (S, 1)-path with ut0 = 7 but not an (S, 0)-path. Based upon the facts Border(S) ⊆ Border(S0) ∪ Border(S00) and S ⊆ Border(S0) ∩ Border(S00) as ensured by Lemma 5.3, we prove the above claim in the following three stages, each of which is also illustrated by Figure 6.

Stage 1. For any nodes u and v in Border(S), let dS,i(u, v) denote the minimum weight of any (S, i)-path of G[Below(S)] between u and v. Any simple path of G[Below(S)]

is an (S, |S|)-path, so dS(u, v) = dS,|S|(u, v). As illustrated by Figure 6(b), we have dR,0(10, 2) = 7 and dR,1(10, 2) = 4. As illustrated by Figure 6(c), we have dS,0(10, 2) =

∞ and dS,1(10, 2) = 9. One can verify the following recurrence relation.

dS,i(u, v) =



0 if i = 0 and u = v;

min{dS0(u, v), dS00(u, v)} if i = 0 and u 6= v;

min{dS,i−1(u, y) + dS,0(y, v) : y ∈ S ∪ {v}} if i ≥ 1.

This stage takes O(|Border(S)|2· |S|2) time via dynamic programming.

Stage 2. For any distinct nodes u and v in Border(S), let eS,i(u, v) denote an incident edge of u in a min-weight (S, i)-path of G[Below(S)] between u and v. If no (S, i)-path of G[Below(S)] between u and v exists, let eS,i(u, v) = ∅. As illustrated by Figure 6(b), edge (10, 6) is the only choice for eR,0(10, 2) and eR,1(10, 2). As illustrated by Fig- ure 6(c), we have eS,0(10, 2) = ∅, and edge (10, 11) is the only choice for eS,1(10, 2).

Let

eS,i(u, v) =



eS0(u, v) if i = 0 and dS0(u, v) ≤ dS00(u, v);

eS00(u, v) if i = 0 and dS0(u, v) > dS00(u, v);

eS,i−1(u, y) if i ≥ 1,

where y can be any node in S ∪{v}\{u} with dS,i(u, v) = dS,i−1(u, y)+dS,0(y, v). Since both eS0(u, v) and eS00(u, v) are incident to u in G[Below(S)], each eS,i(u, v) is incident to u in G[Below(S)]. Therefore, eS,|S|(u, v) is a valid choice of eS(u, v). This stage takes O(|Border(S)|2· |S|2) time via dynamic programming.

Stage 3. For any nodes u and v in Border(S) and any edge e of G[Below(S)] that is incident to Border(S), let dS,i(u, v; e) be the minimum weight of any (S, i)-path in G[Below(S)]\{e}

(14)

between u and v. We have dS(u, v; e) = dS,|S|(u, v; e). As illustrated by Figure 6(b), we have dR,0(10, 2; (10, 6)) = dR,1(10, 2; (10, 6)) = 8. As illustrated by Figure 6(c), we have dS,0(10, 2; (10, 11)) = dS,1(10, 2; (10, 11)) = ∞. One can verify the following recurrence relation.

dS,i(u, v; e) =



0 if i = 0 and u = v;

min{dS0(u, v; e), dS00(u, v; e)} if i = 0 and u 6= v;

min{dS,i−1(u, y; e) + dS,0(y, v; e) : y ∈ S ∪ {v}} if i ≥ 1.

Since the degree of G is O(1), the number of choices of e is O(|Border(S)|). This stage takes O(|Border(S)|3· |S|2) time via dynamic programming.

The lemma is proved.

5.2 Solving the border problems for the special leaf vertices

We need the following linear-time pre-computable data structure in the proof of Lemma 5.6 to solve the border problems of (G, T ) for all special leaf vertices of T as well as in the proof of Lemma 6.1 to solve the leaf problem of (G, T ).

Lemma 5.5. For any given positive integers k = O(log log m)O(1) and w = O(log m)O(1), it takes O(m) time to compute a data structure Table(k, w) such that the following statements hold for any O(1)-degree graph H with at most k nodes whose edge weights are at most w.

1. It takes O(|H|) time to obtain a reference pointer ref(H) from Table(k, w) such that each of the following queries for any two distinct nodes u and v of H can be answered from ref(H) and Table(k, w) in O(1) time: (1) the distance of u and v in H, (2) an edge incident to u that belongs to at least one min-weight path between u and v in H, and (3) the distance of u and v in H \ {e}

for each edge e of H incident to u.

2. It takes O(|H|) time to obtain girth(H) from Table(k, w).

Proof. Let H consist of all graphs of at most k nodes whose maximum weight is at most w.

It takes O(w)O(k2) time to list all graphs H in H. It takes O(kO(1)) time to pre-compute the information in Statements 1 and 2 for each graph H in H. The lemma follows from

³

O(log m)O(1)´(O(log log m)O(1))

· O

³

(log log m)O(1)

´O(1)

= O(m).

Lemma 5.6. Let G be an m-node O(1)-degree r-outerplane graph with wmax(G) = O(log2m). Given an r-dissection tree T of G, the border problems of (G, T ) for all special leaf vertices of T can be solved in O(mr) time.

Proof. We assume that T does have special leaf vertices, since otherwise the lemma holds trivially. By the assumption, we know r ≤ dlog2`(m)e. Let L be a special leaf vertex of T . Let GL = G[L]. Let mL = |L|. By Condition 2 of T , we know mL = Θ(`(m)). Let rL = r + |Border(L)|. Clearly, GLis an mL-node O(1)-degree rL-outerplane graph with rL = O(log2mL). By Lemma 4.1, it takes O(mL) time to obtain an rL-dissection tree TL0 of GL. Let TL be obtained from TL0 by replacing each vertex S0of TL0 by S0∪ Border(L). For instance, let T and G be as shown in Figures 6(a) and 6(b). If L = {2, 3, 4, 7, 8} is a special leaf vertex of T , then GLis as shown in Figure 7(a). We have Border(L) = {2, 7, 8}. If TL0 is as shown in Figure 7(b),

參考文獻

相關文件

Juang has received numerous distinctions and recognitions, including Bell Labs' President Gold Award, IEEE Signal Processing Society Technical Achievement Award, the IEEE

Since everyone needs to write the final solutions alone, there is absolutely no need to lend your homework solutions and/or source codes to your classmates at any time.. In order

Determine how much money the company should spend on newspaper advertising and on television advertising per month to maximize its monthly

6 《中論·觀因緣品》,《佛藏要籍選刊》第 9 冊,上海古籍出版社 1994 年版,第 1

The first row shows the eyespot with white inner ring, black middle ring, and yellow outer ring in Bicyclus anynana.. The second row provides the eyespot with black inner ring

Full credit if they got (a) wrong but found correct q and integrated correctly using their answer.. Algebra mistakes -1% each, integral mistakes

In an oilre nery a storage tank contains 2000 gallons of gasoline that initially has 100lb of an additive dissolved in it. In preparation for winter weather, gasoline containing 2lb

The molal-freezing-point-depression constant (Kf) for ethanol is 1.99 °C/m. The density of the resulting solution is 0.974 g/mL.. 21) Which one of the following graphs shows the