Routing protocols are a set of rules which are used to define an optimal route between sources and destination systems in a network. Basically routing works on the network layer of the OSI reference model.
To determine the best route when multiple updates are received for the same route or we can say when various routes are learned so a router could receive routing updates from several other different routers all about the same network and it needs a mechanism to determine the best one well that’s where the metrics come into play and a metric is a numeric value and it’s different between each routing protocol it could be a small value or an immense value and routing protocol will look at the metric of all the similar route and it will use a lower metric to determine the best route so the general rule of thumb is the lower the metric the better the route and so a routing protocol will look and no compare and if it didn’t have a metric it would have all of these updates about the same network but it would not know which one to use it would have any basis to determine the best route so that’s the purpose to determine the best route.
Each Possible path will be assigned as a ‘metric’ value by the routing protocol which indicates how preferred the path is. Always the lowest metric value is preferred. Distance vector routers advertise to each other the networks they know about and their metrics to get to each of them.