"""TutorSyntax v25: fictional link delays. Not a real network benchmark."""

links_ms = {"A-B": 14, "B-D": 19, "A-C": 11, "C-D": 26, "B-C": 7}
routes = {
    "Blue": ("A-B", "B-D"),
    "Teal": ("A-C", "C-D"),
    "Violet": ("A-B", "B-C", "C-D"),
}

def total_ms(route, failed_link=None):
    if failed_link in route:
        return None
    return sum(links_ms[link] for link in route)

if __name__ == "__main__":
    for failed_link in [None, "B-D"]:
        print("Failed link:", failed_link or "none")
        for name, hops in routes.items():
            print(name, "->", total_ms(hops, failed_link), "ms")
    # Extend: add 5 ms to A-C. Which route becomes shortest?
