RoutingNET/rip_algorithm library

🛣️ RIP (Routing Information Protocol) Algorithm

Implements the Routing Information Protocol based on hop distances for dynamic routing table computation. RIP uses the Bellman-Ford algorithm to find shortest paths based on hop count (distance vector routing).

  • Time Complexity: O(VE) per iteration, where V is vertices, E is edges
  • Space Complexity: O(V²) for routing tables
  • Convergence: Guaranteed to converge in finite iterations
  • Maximum Hops: 15 (RIP limitation to prevent count-to-infinity)
  • Update Frequency: Configurable (typically 30 seconds)

The algorithm maintains routing tables with destination, next hop, cost (hop count), and timestamp information for each route.

Example:

final network = <String, Map<String, num>>{
  'A': {'B': 1, 'C': 1},
  'B': {'A': 1, 'D': 1},
  'C': {'A': 1, 'D': 1},
  'D': {'B': 1, 'C': 1},
};
final rip = RIPAlgorithm<String>();
final routes = rip.computeRoutes(network, 'A');
// Result: Complete routing table from node A

Classes

RIPAlgorithm<T>
RIP Algorithm implementation with configurable parameters
RouteEntry<T>
Represents a routing table entry with destination and routing information
RoutingTable<T>
Represents a complete routing table for a node

Functions

computeRIPRoutes<T>(Map<T, Map<T, num>> network, T sourceNode, {int maxHops = 15}) RoutingTable<T>
Convenience function for quick route computation