Domain: Algorithms & Data Structures

An autonomous vehicle navigation system uses a bidirectional time-dependent Dijkstra algorithm to compute an optimal route on a directed graph
G with 12 nodes labeled N0 through N11 and the following directed edges with base travel times in seconds:

(N0,N1,45), (N0,N2,60), (N1,N3,50), (N1,N4,70), (N2,N4,55), (N2,N5,80),
(N3,N6,65), (N4,N6,40), (N4,N7,90), (N5,N7,60), (N5,N8,75),
(N6,N9,55), (N7,N9,50), (N7,N10,85), (N8,N10,70),
(N9,N11,45), (N10,N11,40).

Travel times depend on the start time of traversal of each edge as follows:

• For any traversal that begins between t = 0 and t = 120 seconds, if the edge is incident to node N4 (either entering or leaving N4), its base weight is multiplied by 1.8.
• For any traversal that begins between t = 120 and t = 240 seconds, if the edge is incident to node N7, its base weight is multiplied by 2.2.
• Outside these windows, all edges use their base weights.

The vehicle departs from node N0 at time t = 0.

Algorithm Definition (Deterministic)

The algorithm runs a forward search from N0 and a backward search from N11 using the following rules:

1. Priority Queues

Each search maintains its own min-heap priority queue ordered by cumulative cost.
Ties inside a queue are broken by smaller node index (e.g., N3 < N4).

2. Expansion Scheduling

At each iteration, the algorithm compares the minimum keys in the forward and backward priority queues and expands the node with the smaller key.
If the two minimum keys are equal, the forward queue is expanded.

3. Forward Search Cost Model

The forward search computes exact arrival times using the time-dependent cost rules above.
When relaxing an edge (u,v), the traversal start time equals the arrival time at u, and the edge cost is multiplied if u or v is N4 or N7 and the traversal start time lies in the corresponding time window.

4. Backward Search Cost Model (Before First Complete Path)

Before any complete N0→N11 path is discovered, the backward search computes distances using base edge weights only, treating them as admissible lower bounds.

5. Backward Search Cost Model (After First Complete Path)

After a complete path with total cost C* is discovered, the backward search recomputes all subsequent relaxations using the same time-dependent cost model as the forward search, assuming arrival at N11 occurs at time C*.

6. Meeting Condition

A node is defined to be a meeting node when it has been expanded (popped from the priority queue) in both the forward and backward searches.

The first such node encountered is recorded as the meeting node.

7. Path Reconstruction

The full path is constructed by concatenating the forward parent chain from N0 to the meeting node and the backward parent chain from the meeting node to N11.

8. Termination Condition

The algorithm terminates when:

min_key_forward + min_key_backward > best_complete_path_cost

where:
• min_key_forward is the smallest key currently in the forward queue,
• min_key_backward is the smallest key currently in the backward queue,
• best_complete_path_cost is the lowest-cost N0→N11 path found so far.

These values are evaluated immediately after each node expansion.

9. Priority Queue Insertions

Every insertion into either priority queue is counted, including duplicate insertions caused by cost improvements.

Task

Determine:

(1) the exact sequence of nodes expanded by the forward search until termination,
(2) the exact sequence of nodes expanded by the backward search until termination,
(3) the first meeting node,
(4) the optimal path from N0 to N11,
(5) the total travel time of that path in seconds, and
(6) the total number of nodes inserted into priority queues across both searches.

Grading rubric:
criterion: Does the answer state the forward expansion sequence exactly as [N0, N1, N2, N3, N5, N4, N6, N8, N9]?
weight: 20
criterion: Does the answer state the backward expansion sequence exactly as [N11, N10, N9, N7, N6, N8, N5, N4]?
weight: 20
criterion: Does the answer identify N9 as the first meeting node?
weight: 20
criterion: Does the answer give the optimal path exactly as N0 → N1 → N3 → N6 → N9 → N11?
weight: 10
criterion: Does the answer compute the total travel time as exactly 260 seconds?
weight: 10
criterion: Does the answer report the total priority queue insertion count as exactly 24?
weight: 10
criterion: Does the answer explicitly show that no N4- or N7-incident edges are used in the optimal path?
weight: 10
criterion: Does the answer demonstrate that termination occurs because min_forward_key + min_backward_key > 260?
weight: 10

Answer:
(1) Forward Expansion Sequence

Forward search starts at N0 at time t = 0 and applies time-dependent weights.

Expand N0 (0)
→ insert N1(45), N2(60)

Expand N1 (45)
→ insert N3(95), N4(171) [70 × 1.8 due to N4 window]

Expand N2 (60)
→ update N4(159) [55 × 1.8], insert N5(140)

Expand N3 (95)
→ insert N6(160)

Expand N5 (140)
→ insert N7(272) [60 × 2.2 due to N7 window], insert N8(215)

Expand N4 (159)
→ attempt update N6(199), ignored (existing 160 is better)

Expand N6 (160)
→ insert N9(215)

Expand N8 (215)
→ insert N10(285)

Expand N9 (215)
→ insert N11(260)

At this point, best complete path cost = 260.
Next forward key = 272, next backward key = 155, and
272 + 155 > 260 ⇒ termination.

Forward Expansion Order:
[N0, N1, N2, N3, N5, N4, N6, N8, N9]

(2) Backward Expansion Sequence

Backward search begins at N11 using base weights until first complete path.

Expand N11 (0)
→ insert N9(45), N10(40)

Expand N10 (40)
→ insert N7(125), N8(110)

Expand N9 (45)
→ update N7(95), insert N6(100)

Expand N7 (95)
→ insert N4(185), insert N5(155)

Expand N6 (100)
→ insert N3(165)

Expand N8 (110)
→ no improvements

Expand N5 (155)
→ insert N2(235)

Expand N4 (185)
→ insert N1(255)

Termination condition satisfied:
272 + 155 > 260.

Backward Expansion Order:
[N11, N10, N9, N7, N6, N8, N5, N4]

(3) First Meeting Node

N9 is expanded in:
• forward search after N6
• backward search after N11

No earlier node is expanded in both searches.

Meeting Node: N9

(4) Optimal Path

Forward parents:
N0 → N1 → N3 → N6 → N9

Backward parents:
N9 → N11

Combined path:

N0 → N1 → N3 → N6 → N9 → N11

(5) Total Travel Time

No N4 or N7 edges appear on this path, so no multipliers apply.

N0 → N1 = 45
N1 → N3 = 50
N3 → N6 = 65
N6 → N9 = 55
N9 → N11 = 45

Total:

45 + 50 + 65 + 55 + 45 = 260 seconds

(6) Total Priority Queue Insertions

Each discovery or cost-improving update counts.

Forward insertions (12):
N1, N2
N3, N4
update N4, N5
N6
N7, N8
N9
N10
N11

Backward insertions (12):
N9, N10
N7, N8
update N7, N6
N4, N5
N3
N2
N1

Total insertions:

12 + 12 = 24