Download presentation

Presentation is loading. Please wait.

Published byBraulio Hellings Modified about 1 year ago

1
Finding a Length-Constrained Maximum-Density Path in a Tree Rung-Ren Lin, Wen-Hsiung Kuo, and Kun-Mao Chao

2
Overview Introduction of the problem. A brief discussion of one-dimensional sequence. Two approaches of finding the maximum- density path in a tree.

3
Input & Output Input ： A weighted tree with n edges and a lower bound L. The lower bound is necessary. Output ： A maximum-density path with length at least L.

4
The Density of a Path The density of a path is defined as follow ： Given a path with k edges E={e 1, e 2, …, e k }, and w(e) is an edge weight function. The density of such path is defined as

5
Lower Bound L = 4 3 2 3 3 5 6 8 7 5 6 3 1 5 1 4 2 1 8 4 2 7 4 8 Max-Density = ( 7+4+6+5+8 ) / 5 = 6

6
The Efficiency We propose two efficient algorithms reach O(nL) time. One of them is further modified to solve some special cases such as full m-ary trees in linear time.

7
One-Dimensional Sequence The maximum-average segment problem arises naturally in several areas of sequence analysis. For example, given a DNA sequence, which segment of the sequence of length at least L has the highest GC ratio. The efficiency of the naïve algorithm of one- dimensional sequence is O(n 2 ).

8
Lower Bound L There exists an optimal segment of length at most 2L-1. It can be proved by a counter argument. The naïve algorithm is O(nL) now. AB

9
The Relation between Two Overlapped Sequences Let P[x] denotes the maximum-density of those segments that start from x. For a given j*
{
"@context": "http://schema.org",
"@type": "ImageObject",
"contentUrl": "http://images.slideplayer.com/14/4183782/slides/slide_9.jpg",
"name": "The Relation between Two Overlapped Sequences Let P[x] denotes the maximum-density of those segments that start from x.",
"description": " For a given j
*

10
Right-Skew Segment A sequence S={s 1, s 2, …, s k } is right-skew if and only if the average of any prefix {s 1, s 2, …, s i ) is never larger than the average of the remaining subsequence {s i+1, …, s k ). According to the tricks mentioned above, Goldwasser et al. proposed a linear time algorithm for one-dimensional sequence.

11
Right-skew Decomposition 5397738918635 4 5 6 7 Decreasing right-skew decomposition is unique

12
Finding Maximum-Density Path In a Tree The path in a tree is similar to the segment of an one-dimensional sequence. That is, there exists a maximum-density path of length at most 2L-1. We propose two approaches reach the time complexity of O(nL).

13
Downward & Upward Paths We classify the paths that start from node K into two types called downward and upward paths. One is to stretch downward to its children only, called downward paths. And the other is to include at least its parent, called upward paths.

14
An upward path of node K K A downward path of node K A general tree

15
Notation Let denotes the maximum-density downward path of node K of length i. Let denotes the second-best one. If there is a tie, choose an arbitrary path. Similarly, represent the maximum upward path of node K of length i.

16
3 5 3 4 3 6 9 2 7 6 3 5 8 4 2 1 8 4 2 7 4 8 8 A

17
Contributor The node which determines its parent’s maximum-density downward path is called contributor. Each maximum-density downward path of a given length has its own contributor. The upward path has no contributor because each node has at most one parent.

18
3 5 3 4 3 6 9 2 7 6 3 5 8 4 2 1 8 4 2 7 4 8 8 A B C D node D node C node D node B

19
Downward & Upward Table The downward table of node K is composed of and, where 1 ≦ i ≦ 2L-1. Note that there exists an optimal path with length at most 2L-1 Similarly, the upward table of node K is composed of, where 1 ≦ i ≦ 2L-1.

20
Constructing Downward Table For a given internal node K with m children {K 1, K 2, …, K m }. Let e j denotes the edge (K, K j ). We can construct the downward table of node K by bottom-up dynamic programming. All contributors should be recorded.

21
Constructing Upward Table Suppose K’ is the parent of node K, and e’ denote the edge (K’, K). Upward Table of node K can be constructed by top-down dynamic programming.

22
Time Complexity Deciding a given length of downward and upward path of any node is O(1). Thus, constructing downward and upward table of a node takes O(L). There are totally n nodes in a tree, so it take O(nL) time to complete all downward and upward tables.

23
Approach I ： Finding the Path from its End Node Once the downward and upward table of each node are constructed, then we can determine the maximum-density path of a given node with length from L to 2L-1 in O(L). Therefore, it takes O(nL) time to check all nodes since there are n nodes in such tree.

24
Approach II ： Finding the Path from its LCA Node LCA stands for least common ancestor. We are now combining two downward paths together.

Similar presentations

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google