def cal_path_distance(graph, path):
    """
    calculate path distance.
    """
    distance = 0.0

    for i, station in enumerate(path):
        if i == 0:
            continue

        distance += graph.edges[path[i-1], path[i]]['distance']

    return distance