How can i set distance(len) for an Edge?

I’m new in this library and I read the tutorial but i still in doubt. I need to creating a project using Dijkstra’s algorithm, so then I have a map and I need to calculate the shortest path. To do that I need to set len(distance) in the edges, for example I have to go from New York to Boston there’s 220 miles, so this edge that connect these citys need to has the value of 220. With what function can I do that? and how can I after from setting all the distances beetween the cities calculate the shortest path?

I think that I understood everything. But now I’m in doubt, how can I draw a graph that works like this, for exemple i have 3 vertices A, B and C, the vertice A are 50km distant of the vertice B and the vertice A are 20km distant of the vertice C, so I want a graph that vertice A is closer to C than to B