Both distance vector and link state routing are lowest algorithms. Tow factors govern how cost is applied to packets in determines a route.
Cost is applied only by routers and not by any other stations on a network. Remember the link from router to the next is a network not a point to point cable. In many topologies every stations on the network example of every packet that phase. If cost was added by every station. Instead of by routers alone. It would accumulate unpredictably ( the number of station in a network can change for a variety of reasons many of them predictable.
Cost is applied as a packet leaves the router rather than as it enters. Most networks are broadcast network. When a packet is in the network every station including the router can pick it up therefore were cannot assign any cost to a packet when it goes form a network to a router.
figure cost in link state routing