mccrieght’s algorithm for linear- time suffix tree construction example

10
McCrieght’s algorithm for linear-time suffix tree construction Example

Upload: hilary-ferguson

Post on 18-Dec-2015

222 views

Category:

Documents


6 download

TRANSCRIPT

Page 1: McCrieght’s algorithm for linear- time suffix tree construction Example

McCrieght’s algorithm for linear-time suffix tree construction

Example

Page 2: McCrieght’s algorithm for linear- time suffix tree construction Example

Example string: AAAAAAA1 2 3 4 5 6 7 8

A A A A A A A $

rootT0:

Conventions: • Ti corresponds to the tree after i iterations.• Suffix numbering and string indexing starts from 1 and ends at n.• Only for convenience in presentation, edge-labels are shown as strings.

In the implementation, it is assumed that edge-labels are storedas a pair of integers.

T1:

Initial tree:Denotes suffix links

Page 3: McCrieght’s algorithm for linear- time suffix tree construction Example

Example string: AAAAAAA1 2 3 4 5 6 7 8

A A A A A A A $

rootT0: root

T1:

1

AA

AA

AA

A$

Tally of cost

Number of character comparisons

0

Number of node hops 0

Iteration: 1

For this iteration:

Page 4: McCrieght’s algorithm for linear- time suffix tree construction Example

Example string: AAAAAAA1 2 3 4 5 6 7 8

A A A A A A A $

rootT2:

1

AA

AA

AA

A$

Tally of cost

Number of character comparisons

7

Number of node hops 0

Iteration: 2

rootT1:

1

AA

AA

AA

A$

Case IB

2

$For this iteration:

Page 5: McCrieght’s algorithm for linear- time suffix tree construction Example

Example string: AAAAAAA1 2 3 4 5 6 7 8

A A A A A A A $

rootT3:

1

AA

AA

AA

A$

Tally of cost

Number of character comparisons

1

Number of node hops 1

Iteration: 3

Case IIB

2

$

rootT2:

1

AA

AA

AA

A$

2

$

=AAAAAA = A ’

3

$

For this iteration:

Page 6: McCrieght’s algorithm for linear- time suffix tree construction Example

Example string: AAAAAAA1 2 3 4 5 6 7 8

A A A A A A A $

rootT4:

1

AA

AA

AA

A$

Tally of cost

Number of character comparisons

1

Number of node hops 1

Iteration: 4

Case IIB

2

$

rootT3:

1

AA

AA

A

AA

$2

$

=AAAAA = A ’

3

$

3

$ 4

$

For this iteration:

Page 7: McCrieght’s algorithm for linear- time suffix tree construction Example

Example string: AAAAAAA1 2 3 4 5 6 7 8

A A A A A A A $

rootT5:

1

AA

AA

AA

A$

Tally of cost

Number of character comparisons

1

Number of node hops 1

Iteration: 5

Case IIB

2

$

rootT4:

1

AA

AA

A

AA

$2

$

=AAAA = A ’

3

$

3

$ 4

$4

$5

$

For this iteration:

Page 8: McCrieght’s algorithm for linear- time suffix tree construction Example

Example string: AAAAAAA1 2 3 4 5 6 7 8

A A A A A A A $

rootT6:

1

AA

AA

AA

A$

Tally of cost

Number of character comparisons

1

Number of node hops 1

Iteration: 6

Case IIB

2

$

rootT5:

1

AA

AA

A

AA

$2

$

=AAA = A ’

3

$

3

$ 4

$4

$5

$5

$6

$

For this iteration:

Page 9: McCrieght’s algorithm for linear- time suffix tree construction Example

Example string: AAAAAAA1 2 3 4 5 6 7 8

A A A A A A A $

rootT7:

1

AA

AA

AA

A$

Tally of cost

Number of character comparisons

1

Number of node hops 1

Iteration: 7

Case IIB

2

$

rootT6:

1

AA

AA

A

AA

$2

$

=AA = A ’

3

$

3

$ 4

$4

$5

$5

$6

$6

$7

$

For this iteration:

Page 10: McCrieght’s algorithm for linear- time suffix tree construction Example

Example string: AAAAAAA1 2 3 4 5 6 7 8

A A A A A A A $

rootT8:

1

AA

AA

AA

A$

Tally of cost

Number of character comparisons

0

Number of node hops 0

Iteration: 8

Case IIB

2

$

rootT7:

1

AA

AA

A

AA

$2

$

=A = A ’

3

$

3

$ 4

$4

$5

$5

$6

$6

$7

$7

$8

$ TOTAL Tally of cost over all iterations

Number of character comparisons

12

Number of node hops 5

For this iteration: