RoutingNET/bgp_algorithm library

🌍 BGP (Border Gateway Protocol) Algorithm

Implements the Border Gateway Protocol for inter-domain routing with path vector routing and policy-based decision making. BGP is the de facto standard for routing between autonomous systems (AS) on the Internet.

  • Time Complexity: O(V²) for path computation and policy evaluation
  • Space Complexity: O(V²) for routing information base (RIB)
  • Convergence: Slow convergence due to policy complexity
  • Path Selection: Based on multiple attributes and policies
  • AS Support: Full autonomous system number support

The algorithm maintains a routing information base (RIB) with path attributes, community values, and policy-based route selection.

Example:

final asTopology = <int, Map<int, num>>{
  100: {200: 1, 300: 1},
  200: {100: 1, 400: 1},
  300: {100: 1, 400: 1},
  400: {200: 1, 300: 1},
};
final bgp = BGPAlgorithm<int>();
final routes = bgp.computeRoutes(asTopology, 100);
// Result: Complete BGP routing table with AS paths

Classes

BGPAlgorithm<T>
BGP Algorithm implementation with policy-based route selection
BGPPathAttributes
Represents BGP path attributes for route selection
BGPRouteEntry<T>
Represents a BGP route with path attributes and policy information
BGPRoutingTable<T>
Represents the BGP routing information base (RIB)

Enums

BGPOrigin
BGP origin types

Functions

computeBGPRoutes<T>(Map<T, Map<T, num>> asTopology, T sourceAS, {Map<String, dynamic>? policies}) BGPRoutingTable<T>
Convenience function for quick BGP route computation