How can I add weights to vertices based on the topological distance?

Ah, sorry, I jumped to conclusions a bit too early :smiley:
Besides the shortest path mentioned by Toni, I had to think of the heat method, see for example this thread: Heat Method - Grasshopper - McNeel Forum