Intuition The one core idea
Link state routing means every router builds the same complete map of the network, then privately computes the shortest path to everywhere . To understand it you need just three picture-ideas: a graph (dots joined by weighted lines), a shortest path (the cheapest walk along those lines), and the greedy rule that grows finalized distances outward from a source.
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.
The parent note says routers, cities, postcards. Underneath all of that is one clean mathematical object: a graph .
Definition Graph — nodes and edges
A graph is a set of nodes (dots) connected by edges (lines). Here:
a node = a router (or city). We give each one a name letter: A , B , C , …
an edge = a physical link between two routers.
That's it. A graph is "dots and the lines between them."
Intuition Why the topic needs this
A router doesn't care what a cable is made of. It only cares "who am I connected to, and how expensive is that hop?" A graph throws away everything irrelevant and keeps exactly that. Every LSP the parent describes is really one node announcing its own edges .
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 u → v . The relaxation rule is written with an arrow because we ask "what if the last hop into v came from u ?"
w ( u , v )
==w ( u , v ) == is the cost (a number) of using the edge from node u to node v . Read it out loud as "the weight of the edge from u to v ."
In OSPF this number is a link cost (roughly, "how slow / expensive is this link").
It is always a positive number in OSPF — remember this, it decides everything later.
Intuition Why a number and not just "connected/not"?
If every edge cost the same, "shortest path" would just mean "fewest hops." Real networks have fast and slow links, so we attach a number to each edge. The whole point of Dijkstra is to add these numbers up and find the smallest total.
w ( u , v ) is a distance in kilometres"
Why it feels right: we call it a "cost" or "length." Why it's wrong: it's an abstract number — could be based on bandwidth, delay, or an admin's choice. Fix: treat w as "the price to walk this one edge," nothing more.
Definition Path and path length
A path from s to v is a sequence of edges you walk, like A → B → C → D .
The length of a path = the sum of the weights of every edge on it.
Worked example Reading a path length
In the parent's graph, the path A → B → C has length w ( A , B ) + w ( B , C ) = 2 + 1 = 3 .
The direct path A → C has length w ( A , C ) = 5 .
So A → B → C (cost 3 ) is cheaper than going direct (cost 5 ). That is exactly why the parent's table drops d [ C ] from 5 to 3 .
To travel a whole route you pay for every edge you use, one after another. Adding them is just "total the bill." The shortest path is the route with the smallest total bill.
This is the single most important notation in the parent note. It looks scary; it is not.
d [ v ] — tentative distance to v
==d [ v ] == is a labelled box attached to node v holding the length of the cheapest path we have found so far from the source s to v .
"Tentative" means "our current best guess — it may still shrink."
The square brackets [ v ] just mean "the box belonging to node v ," like a labelled locker.
Intuition Why keep a "best so far" box?
We discover better routes as we explore. Instead of recomputing everything, each node keeps its current best number and lowers it whenever we find something cheaper. When we're done exploring, that box holds the true shortest distance.
d [ s ] = 0 and d [ others ] = ∞
d [ s ] = 0 : the distance from the source to itself costs nothing — you're already there.
d [ v ] = ∞ (the symbol ==∞ == means "infinitely large / unreachable so far"): before we've found any route to v , we pretend it's infinitely far, so any real path we discover will be smaller and will replace it.
Intuition Why not just leave it blank?
Using ∞ lets one rule ("keep the smaller number") work uniformly. A blank would need a special case; ∞ removes the special case because everything is smaller than infinity .
min ( a , b )
==min ( a , b ) == simply means "the smaller of the two numbers a and b ." min ( 3 , 5 ) = 3 .
Now the parent's central formula. Let's earn every piece:
d [ v ] ← min ( d [ v ] , d [ u ] + w ( u , v ) )
Read it piece by piece:
d [ u ] + w ( u , v ) = "the cost to reach u , plus one more hop from u to v ." This is one specific route to v : the one whose last step is u → v .
d [ v ] (the left thing inside min ) = the best route to v we already knew, which does not use that last hop.
min ( … ) = keep whichever is cheaper.
The arrow ← means "store this new value into d [ v ] " (assignment, not equality).
← and = are the same"
Why it feels right: both use an equals-looking sign. Fix: ← updates a box (do this, then move on); = asserts two things are equal forever. Relaxation is an update.
S and ∅
==S == is the set of finalized nodes — nodes whose d [ ⋅ ] box is now locked , guaranteed correct, never to change.
==∅ == is the empty set : a set containing nothing. We start with S = ∅ because at the beginning nobody is finalized.
u ∈ / S reads "node u is not in the finalized set" (still tentative).
Intuition Why a "locked" set?
Dijkstra grows a frontier of certainty outward from the source. Once a node is locked, we never re-examine it — that's what makes the algorithm efficient. The figure shows S as the shaded region swallowing one new node each round.
Intuition The claim, stated with our symbols
Among all nodes not in S , take the one u with the smallest d [ u ] . Claim: that d [ u ] is already the final shortest distance — lock it.
Why? Any other route to u must leave the locked region S somewhere, then travel further. Because every w ≥ 0 , that detour can only add cost, so it can't beat the value we already have. This is the exact reason the parent stresses non-negative weights : a negative edge could secretly shrink a "finalized" number, and the lock would be a lie.
Recall Where does the parent use each symbol?
w ( A , B ) = 2 — the edge weights in Worked Example 1.
d [ C ] dropping 5 → 3 — relaxation via B .
S = { A } then { A , B } — the "Finalized" column.
∞ — the init row of the table.
O ( ⋅ ) , V , E , log
==V == = number of nodes (vertices); ==E == = number of edges.
log V = the logarithm of V : roughly "how many times you halve V to reach 1." It shows up because a good priority queue (binary heap) finds the minimum in log V steps.
==O ( … ) == ("big-O") means "grows no faster than this, ignoring constant factors." It answers "how does the running time scale as the network gets huge?"
Intuition Why we care about scaling, not exact time
A backbone can have thousands of routers. We don't need the exact microseconds; we need "does it stay fast as V grows?" O (( V + E ) log V ) says: yes, close to linear. That's why Dijkstra is practical for OSPF.
d of v: best distance so far
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.
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 w ( u , v ) mean, and what sign is it in OSPF? The cost/weight of the edge from u to v ; 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 d [ v ] hold? The length of the cheapest path found so far from the source to v (a tentative best guess).
Why do we initialise d [ s ] = 0 and d [ others ] = ∞ ? The source reaches itself for free; unknown nodes start "infinitely far" so any real route replaces it.
What does min ( a , b ) do? Returns the smaller of the two numbers.
Explain the relaxation rule in words. d [ v ] becomes the smaller of its old value and d [ u ] + w ( u , v ) — the two exhaustive cases (path avoids u , or its last hop is u → v ).
What is the set S and what is ∅ ? S is the set of finalized (locked) nodes; ∅ is the empty set, the starting value of S .
Why must edge weights be non-negative for the greedy pick to be valid? A detour out of S 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 O (( V + E ) log V ) tell you? How the running time scales with V nodes and E edges — near-linear, so Dijkstra stays fast for large networks.