def total_weight(graph, path):
    """Sum the weights of the edges between nodes in path

    Args:
        graph (Graph): A graph containing nodes and edges between them
        path (list of str): A list of strings representing nodes in graph

    Returns:
        int: The total weight of all the implied edges in path
    """
    pairs = zip(path, path[1:])
    weight = sum(graph.weight(*p) for p in pairs)
    return weight