The printed formula for the edge label has mismatched variable names. The type-correct reading is . Interpret the requested route as a directed walk of consecutive labelled edges, allowing repeated vertices; the distinction from a vertex-simple directed path is discussed below.
Let be the set of vertices reachable from the specified start after reading exactly the first labels. Initialize and updateAfter stages, answer yes exactly when . A directed walk realizing a prefix decomposes into a walk realizing the shorter prefix and one correctly labelled final edge; conversely every such extension is valid. This proves the dynamic programming invariant by induction on . Store reachable vertices in Boolean arrays and scan the edges per stage. The running time is with rolling-table space complexity, in addition to graph storage. The empty label sequence is realized by staying at .
If “path” is instead required to mean vertex-simple, augment the state to , where is the set of visited vertices. Start with and extend a matching edge to only when , replacing by . This gives an exact dynamic programming algorithm for that interpretation too; reject immediately when . A straightforward bound is running time with rolling-table storage. The exponential distinction is substantive: all labels equal and include the Hamiltonian path problem from a fixed start. The efficient layered recurrence answers the consecutive-edge interpretation without pretending to enforce distinct vertices.
Use the multiplicative score exactly as defined in the paper. Let be the largest score of a matching length- route ending at . Initialize and mark all other entries unreachable. For each stage, clear the new layer and inspect matching edges from reachable entries:An empty candidate set is marked unreachable, rather than given score zero: a genuine route may have score zero. A Boolean reachability table or a sentinel with a guard before multiplication distinguishes the cases. Store the maximizing predecessor edge at each reachable layer entry, retaining one on a tie.
Multiplication by a nonnegative edge factor preserves order, so replacing a prefix by a larger-scoring matching prefix cannot worsen its extension. Induction proves this maximum-product edge-labelled walk recurrence correct. Choose a reachable final entry of greatest score and follow its layer-indexed predecessors backwards to reconstruct the answer. If no final entry is reachable, report that no matching route exists, even though all numeric scores might otherwise look like zero.
The running time is , and rolling scores have space complexity , while retaining all reconstruction pointers gives space complexity . For the vertex-simple interpretation, retain the visited set in each state as in part i, prohibit revisits and maximize the same products over those states. This exact exponential-state variant preserves both the zero-score distinction and predecessor reconstruction. If the starting vertex is unrestricted rather than inherited from part i, initialize for every vertex. The calculation needs no independence assumption beyond the paper's definition of a product score; repeated physical edge-activation events would require a separate probabilistic model.
Articles by others on the same topic
There are currently no matching articles.