A topic in the Open Knowledge Graph — a free, open map of 15,290 topics and the order to learn them in.

Bellman-Ford Algorithm and Distance-Vector Routing

Graduate Depth 97 in the knowledge graph ☐ I know this ☆ Set as goal
7topics build on this
604prerequisites beneath it
See this on the map →
Bellman-Ford AlgorithmRouting Algorithms and Protocols→→Distance-Vector Routing Protocols
bellman-ford distance-vector rip distributed-algorithm

Core Idea

The Bellman-Ford algorithm is the basis for distance-vector routing protocols (e.g., RIP) where routers share their distance vectors (hop counts or costs) with direct neighbors. Each router updates its routing table based on neighbors' announcements, converging to shortest paths in a distributed manner, though more slowly than link-state protocols.

Explainer

From your study of routing algorithms and the Bellman-Ford shortest-path algorithm, you know that finding optimal paths through a network graph requires systematically relaxing edge weights until distances stabilize. Distance-vector routing applies this algorithm in a distributed setting: instead of one central computer running Bellman-Ford on the entire network topology, each router independently runs its own local version, sharing partial results with its neighbors until the whole network converges on correct routing tables.

Here is how it works in practice. Each router maintains a distance vector — a table listing every known destination and the estimated cost (typically hop count) to reach it. Initially, each router only knows about its directly connected neighbors (cost = 1 hop or the link's metric). Periodically — every 30 seconds in RIP (Routing Information Protocol) — each router sends its entire distance vector to all directly connected neighbors. When a router receives a neighbor's distance vector, it applies the Bellman-Ford equation: for each destination D in the neighbor's table, it computes "cost to reach that neighbor + neighbor's cost to reach D." If this total is less than the router's current best cost to D, it updates its own table to route through that neighbor. Over successive rounds of exchange, shortest-path information propagates outward from each destination like ripples in a pond, and all routers converge to optimal routes.

The elegance of this approach is its simplicity: routers need no global knowledge of the network topology. Each router only talks to its immediate neighbors, and correct global routing emerges from purely local interactions. However, this simplicity comes with significant drawbacks. Convergence is slow — information propagates one hop per update interval, so a network with a diameter of 15 hops takes at minimum 15 rounds (7.5 minutes in RIP) to fully converge after a change. Worse, distance-vector protocols suffer from the count-to-infinity problem: when a link fails, routers may keep advertising stale routes to each other, incrementing the cost by one each round until it finally exceeds a maximum threshold (16 in RIP, which treats 16 as infinity). During this slow convergence, routing loops form and packets circle endlessly.

Several techniques mitigate these problems. Split horizon prevents a router from advertising a route back to the neighbor it learned it from — if router A reaches network X through router B, it does not tell B about that route, since B already knows a better path. Poison reverse strengthens this by explicitly advertising such routes with infinite cost. Triggered updates send changes immediately when a route fails rather than waiting for the periodic timer. Despite these fixes, distance-vector protocols remain slower to converge than link-state alternatives like OSPF, which is why RIP is largely confined to small networks. But the Bellman-Ford distributed model lives on in BGP (Border Gateway Protocol), the protocol that routes traffic between autonomous systems across the entire Internet — proof that the distance-vector concept scales when adapted appropriately.

Practice Questions 5 questions

Prerequisite Chain

Understanding Zero → The Number Zero → Counting to Five → Counting to 10 → Counting to 20 → Counting a Set of Objects Up to 20 → Cardinality: The Last Number Counted → Matching Numerals to Quantities → Subitizing Small Quantities → Addition Within 10 → Number Bonds to 10 → Addition Within 20 → Doubles and Near Doubles → Doubles Facts Within 10 → Near Doubles Facts Within 20 → Mental Math Strategies for Addition → Mental Math: Adding and Subtracting Tens → Addition Within 100 → Repeated Addition as Multiplication → Multiplication as Equal Groups → Multiplication: Arrays → Basic Multiplication Facts (0s, 1s, 2s, 5s, 10s) → Multiplication Facts Within 100 → Division as Equal Sharing → Division as Grouping (Measurement Division) → Division: Grouping (Repeated Subtraction) Model → Division: Fair Sharing Model → Division as Equal Sharing → Division as Grouping → Basic Division Facts → Division Facts Within 100 → Multiplication and Division Fact Families → Relationship Between Multiplication and Division → Division Facts as Inverse of Multiplication → Remainders and Quotients in Division → Division Word Problems → Multi-Step Word Problems → Solving Multi-Step Word Problems → Multiplication Word Problems → Division Word Problems → Introduction to Long Division → Factors and Multiples → Prime and Composite Numbers → Equivalent Fractions → Relating Fractions and Decimals → Decimal Place Value → Integers and the Number Line → Comparing and Ordering Integers → Absolute Value → Adding Integers → Subtracting Integers → Multiplying Integers → Introduction to Exponents → Order of Operations → Integer Order of Operations → Variable Expressions → The Distributive Property → Variables and Expressions Review → Introduction to Polynomials → Adding and Subtracting Polynomials → Multiplying Polynomials → Factorial → Permutations → Combinations → Counting Principles: Addition and Multiplication Rules → Introduction to Graph Theory → Propositional Logic Foundations → Logical Equivalences → Boolean Algebra → Boolean Type and Truth Values → Comparison Operators and Boolean Tests → Logical Operators and Boolean Algebra → Conditional Statements → Defining and Calling Functions → Functions: Decomposing Problems → Function Parameters and Argument Passing → Return Values → Variable Scope → Introduction to Classes → Objects and Instances → Methods and Attributes → Algorithm Design Basics → Tree Structure and Node Properties → Binary Trees → Tree Traversals → Depth-First Search (DFS) → Depth-First Search: Implementation and Applications → Topological Sort → Dynamic Programming → Longest Common Subsequence (LCS) Problem → Edit Distance: Levenshtein Distance and DP → 0/1 Knapsack Problem: Bounded Capacity DP → Greedy Algorithms → Activity Selection Problem Using Greedy Algorithms → Dijkstra's Algorithm → Floyd-Warshall Algorithm for All-Pairs Shortest Paths → Bellman-Ford Algorithm → Bellman-Ford Algorithm and Distance-Vector Routing

Longest path: 98 steps · 604 total prerequisite topics

Prerequisites (2)

Leads To (1)