4.3.16 · D1Computer Networks

Foundations — Link state routing — OSPF, Dijkstra

2,072 words9 min readBack to topic

Before you can read the parent note, you must be able to see every symbol it throws at you. This page builds each one from nothing — plain words first, then a picture, then why the topic needs it. Read top to bottom; each block leans on the one above.


1. What is a network, really? — the graph

The parent note says routers, cities, postcards. Underneath all of that is one clean mathematical object: a graph.

Figure — Link state routing — OSPF, Dijkstra

Two flavours matter:

  • Undirected edge: the line works both ways (A–B is the same as B–A). Worked Example 1 in the parent uses undirected links.
  • Directed edge: a one-way arrow . The relaxation rule is written with an arrow because we ask "what if the last hop into came from ?"

2. Cost / weight — the number on each edge

Figure — Link state routing — OSPF, Dijkstra

3. A path, and the length of a path


4. The symbol — best-known distance so far

This is the single most important notation in the parent note. It looks scary; it is not.

Figure — Link state routing — OSPF, Dijkstra

5. Infinity and zero — the starting values


6. The operation and the relaxation rule

Now the parent's central formula. Let's earn every piece:

Read it piece by piece:

  • = "the cost to reach , plus one more hop from to ." This is one specific route to : the one whose last step is .
  • (the left thing inside ) = the best route to we already knew, which does not use that last hop.
  • = keep whichever is cheaper.
  • The arrow means "store this new value into " (assignment, not equality).

7. The finalized set and the empty set

Figure — Link state routing — OSPF, Dijkstra

8. The greedy invariant — why "pick the smallest" is safe

Recall Where does the parent use each symbol?
  • — the edge weights in Worked Example 1.
  • dropping — relaxation via .
  • then — the "Finalized" column.
  • — the init row of the table.

9. Big-O notation — reading


How these feed the topic

Graph: nodes and edges

Edge weight w

Path and path length

d of v: best distance so far

Infinity and zero init

min operation

Relaxation rule

Finalized set S

Greedy invariant

Dijkstra

Big-O and V E log

Link State Routing and OSPF

Each foundation on the left must be solid before the arrow it feeds. If any box is fuzzy, the parent note will feel like magic — go back and re-read that block.


Equipment checklist

Test yourself — you should be able to answer each before reading the parent:

What is a graph, in one sentence?
A set of nodes (dots) joined by edges (lines); here nodes are routers and edges are links.
What does mean, and what sign is it in OSPF?
The cost/weight of the edge from to ; always positive in OSPF.
What is the length of a path?
The sum of the weights of all edges on that path.
What does the box hold?
The length of the cheapest path found so far from the source to (a tentative best guess).
Why do we initialise and ?
The source reaches itself for free; unknown nodes start "infinitely far" so any real route replaces it.
What does do?
Returns the smaller of the two numbers.
Explain the relaxation rule in words.
becomes the smaller of its old value and — the two exhaustive cases (path avoids , or its last hop is ).
What is the set and what is ?
is the set of finalized (locked) nodes; is the empty set, the starting value of .
Why must edge weights be non-negative for the greedy pick to be valid?
A detour out of only adds non-negative cost, so it can't beat the locked value; a negative edge could later shrink it and break the lock.
What does tell you?
How the running time scales with nodes and edges — near-linear, so Dijkstra stays fast for large networks.

Connections