PROJECTENGRAM

DIJKSTRA'S ALGORITHM (ADVANCED)

Dijkstra's Algorithm (Advanced)

Tags: #◇CSNETWK #◇Computer Science #◇Computer Networks #◇Networking Protocols #◇Graph Theory Basics


◇Overview

In advanced problems, you may be given the result (the forwarding table) and asked to deduce the missing properties of the network (link costs).

◇Key Concepts

Shortest Distance Previous Node (Predecessor) Source Provided Table Unknowns

◇Details / Theory

◇1. Concept Overview: The Forwarding Table

Definition

In advanced problems, you may be given the result (the forwarding table) and asked to deduce the missing properties of the network (link costs).

Reading the Table
Shortest Distance: The total cost from Source to Destination. Previous Node (Predecessor): The last hop taken to get to the destination. This reveals the structure of the path.

◇2. The Network Topology

Scenario Data
!◇Pasted image 20251121093359.png
Provided Table:
X (0, n/a)
W (3, X)
V (4, X)
U (6, V)
Y (7, X)
Z (9, Y) Unknowns:
Link cost x (between Y and W)
Link cost y (between Y and Z)

◇3. Problem Analysis

Question 1

For link X, what is the cost associated with this link?

Analytical Breakdown:

  1. Analyze the Graph: Link x connects Y and W.

  2. Analyze the Table:
    Path to Y: Direct from X (Cost 7).
    Path to W: Direct from X (Cost 3).

  3. Check Usage: Does any shortest path use the link Y-W?
    If we went X →\rightarrow W →\rightarrow Y, cost would be 3+cost(x)3 + \text{cost}(x). Since the actual cost to Y is 7 (direct), this path implies 3+x≥73 + x \ge 7.
    If we went X →\rightarrow Y →\rightarrow W, cost would be 7+cost(x)7 + \text{cost}(x). Since the actual cost to W is 3, this is impossible.

  4. Conclusion: The table shows that the shortest path to W is direct (via X) and the shortest path to Y is direct (via X). The link connecting Y and W is never used in any shortest path from X. Therefore, its weight cannot be calculated precisely from this table alone.

Correct Answer: n/a

Question 2

For link Y, what is the cost associated with this link?

Analytical Breakdown:

  1. Analyze the Graph: Link y connects Y and Z.

  2. Analyze the Table (Row Z):
    Destination: Z
    Shortest Distance: 9
    Previous Node: Y

  3. Logical Deduction:
    The path to Z goes through Y.
    Mathematically: D(Z)=D(Y)+c(Y,Z)D(Z) = D(Y) + c(Y,Z)

Substitute values from table: 9=7+c(Y,Z)9 = 7 + c(Y,Z)

Solve for c(Y,Z)c(Y,Z): 9−7=29 - 7 = 2

  1. Conclusion: The cost of the link y must be 2.

Correct Answer: 2

◇Summary of Logic (Cheat Sheet)

Reverse Engineering Formula:

Cost(Link A→B)=D(B)−D(A)\text{Cost}(\text{Link } A \rightarrow B) = D(B) - D(A)

(This only applies if A is the "Previous Node" for B).
Step 1: Find the destination in the table (e.g., Z). Step 2: Check its "Previous Node" (e.g., Y). Step 3: Subtract Distance(Previous) from Distance(Destination).

◇Common Pitfalls

Using D(B)−D(A)D(B) - D(A) when AA is not BB’s predecessor — the formula only works along the shortest-path tree. Assuming every link cost can be deduced — links not on any shortest path may have indeterminate costs (only a lower bound). Confusing the forwarding table’s "previous node" with the original source.

◇Summary

TL;DR — Advanced Dijkstra problems reverse-engineer link costs from completed forwarding tables. If node AA is BB’s predecessor, then cost(A→B)=D(B)−D(A)\text{cost}(A \to B) = D(B) - D(A). Links unused in any shortest path may have unknown exact costs.

Related: - ◇Pasted image 20251121093359.png Source / Reference:

◇References & Navigation

CONFIRMATION // 理解度の確認

ACTIVE RECALL VERIFICATION

Select an answer to verify conceptual comprehension and reveal the technical rationale.

Q1

In a trace of Dijkstra's Link-State algorithm starting from source node uu, if two paths to node vv have the exact same minimum cumulative cost D(v)D(v), what is the effect of the tie-breaking rule?

Q2

During each step of Dijkstra's algorithm, after adding node ww (the node not yet in N′N' with the smallest D(w)D(w)) to the visited set N′N', which nodes vv have their distance estimates D(v)D(v) relaxed?

Q3

Why does Dijkstra's greedy selection—permanently locking in D(w)D(w) as final as soon as ww is added to N′N'—require all link costs c(x,y)c(x, y) to be non-negative (c(x,y)≥0c(x, y) \ge 0)?

Q4

Once Dijkstra's algorithm terminates at source router uu, how does router uu construct its forwarding table entry (Destination, Outgoing Next-Hop Interface) for a distant node zz?

Q5

What is route oscillation in Link-State routing when link costs are set equal to the real-time traffic load carried on each link?

Dijkstra's Algorithm (Advanced) | PROJECT ENGRAM