Added a function to compute the cost of sending a message in order to determine network proximity.