To calculate its routing table each router applies an algorithm called the dijkstra algorithm to its state database. The dijkstra algorithm calculates the shortest path between two points on a network using a graph using a made up of nodes and arcs. Notes are of two types networks and routers. Arcs are the connection between a router and a network ( router to network and network to router). Cost is applied only to the are from router to network. The cost of the from network to router is always zero .
Costs in the dijkstra algorithm