def add_delay_columns(data):
    """Compute edge durations and delays."""
    data["event_delay"] = (
        data["event_time_real"] - data["event_time_planned"]
    ).dt.total_seconds().astype("float32") / 60
    data["edge_duration_planned"] = (
        data["next_event_time_planned"] - data["event_time_planned"]
    ).dt.total_seconds().astype("float32") / 60
    data["edge_duration_real"] = (
        data["next_event_time_real"] - data["event_time_real"]
    ).dt.total_seconds().astype("float32") / 60
    data["edge_delay"] = (
        data["edge_duration_real"] - data["edge_duration_planned"]
    ).astype("float32")

    return data