07.01.2013 Views

Lecture Notes in Computer Science 3472

Lecture Notes in Computer Science 3472

Lecture Notes in Computer Science 3472

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

18 Sven Sandberg<br />

By def<strong>in</strong>ition, the backward transitions on <strong>in</strong>put a from some state {s ′ , t ′ }∈S ′<br />

are all {s, t} so that s ∈ δ −1 (s ′ , a) andt ∈ δ −1 (t ′ , a). For a s<strong>in</strong>gle state and a<br />

s<strong>in</strong>gle <strong>in</strong>put, these can be found <strong>in</strong> time O(r), where r is the number of result<strong>in</strong>g<br />

backward transitions. Consequently, the breadth-first search can still be done <strong>in</strong><br />

O(n 2 ·|I |) time even if edges are not represented explicitly.<br />

Leav<strong>in</strong>g out Tables. To reduce the space needed by tables, we will leave out the<br />

tables for all but at most every n’th node of the forest, so the distribution of<br />

tables <strong>in</strong> the forest becomes “sparse”. At the same time we will guarantee that<br />

follow<strong>in</strong>g the shortest path from any node toward a root, a node with a table<br />

will be found after at most n steps. Thus, when the ma<strong>in</strong> algorithm computes<br />

δ(δ(S, x ), y) it has to follow the shortest path <strong>in</strong> the forest for at most n steps<br />

per state <strong>in</strong> δ(S, x ) before it can look up the answer. As a result, the total time<br />

over all iterations to update δ(S, xy) growstoO(n 3 ), but that is with<strong>in</strong> the time<br />

limit.<br />

Which Tables to Leave out. To determ<strong>in</strong>e which nodes <strong>in</strong> the shortest path forest<br />

that should have a table, we first take a copy of the forest. Take a leaf of maximal<br />

depth, follow the path from this leaf toward the root for n steps and let {s, t}<br />

bethenodewearriveat.Mark{s, t} as a node for which the table should be<br />

computed, and remove the entire subtree rooted at {s, t}. Repeat this process<br />

as long as possible, i.e., until the result<strong>in</strong>g forest has depth less than n. S<strong>in</strong>ce<br />

every removed subtree has depth n, the path from any node to a marked node<br />

has length at most n, thus guarantee<strong>in</strong>g that updat<strong>in</strong>g δ(u, xy) needs at most n<br />

steps. Moreover, every removed subtree has at least n nodes, so tables will be<br />

stored <strong>in</strong> at most every n’th node.<br />

Comput<strong>in</strong>g Tables When They Are Few. F<strong>in</strong>ally, comput<strong>in</strong>g the tables when they<br />

are more sparsely occurr<strong>in</strong>g is done almost as before, but <strong>in</strong>stead of us<strong>in</strong>g the<br />

table value from a parent, we f<strong>in</strong>d the nearest ancestor that has a table, requir<strong>in</strong>g<br />

O(n) time for every element of every table, summ<strong>in</strong>g up to O(n 3 ) because there<br />

are O(n) tables with n entries each.<br />

We conclude the proof with a summary of the requirements of the algorithm.<br />

• The graph M ′ needs O(n 2 ) space for nodes and O(n ·|I |) for edges.<br />

• There are O(n) tables, each one tak<strong>in</strong>g O(n) space, so totally O(n 2 ).<br />

• The breadth-first search needs O(n 2 ·|I |) time.<br />

• Comput<strong>in</strong>g the tables needs O(n 3 )time.<br />

• In each of the O(n) iterations, comput<strong>in</strong>g δ(S, xy) needs O(n 2 )time.<br />

• In each iteration, writ<strong>in</strong>g the merg<strong>in</strong>g sequence to the output is l<strong>in</strong>ear <strong>in</strong> its<br />

length, which is bounded by O(n 2 ). ⊓⊔<br />

Length of Synchroniz<strong>in</strong>g Sequences. The merg<strong>in</strong>g sequences computed are<br />

of m<strong>in</strong>imal length, because breadth-first search computes shortest paths. Unfortunately,<br />

this does not guarantee that Algorithm 2 f<strong>in</strong>ds a shortest possible<br />

synchroniz<strong>in</strong>g sequence, s<strong>in</strong>ce the order <strong>in</strong> which states to merge are picked may<br />

not be optimal. It is possible to pick the states that provide for the shortest<br />

merg<strong>in</strong>g sequence without <strong>in</strong>creas<strong>in</strong>g the asymptotic runn<strong>in</strong>g time, but there are<br />

mach<strong>in</strong>es where this strategy is not the best. In fact, we will see <strong>in</strong> Section 1.4.1

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!