A function is needed to access the weight of an edge in the graph object. This would be used in computing the cumulative cost along the path.