def build_gragh(graph_string):
    """
    A quick parser from string into a dict that represent the graph.
    Keys in the root level are the start of the path, keys in the result
    are the desinations, values are the distance of the path
    sample format:
    AB5, BC4
    returns {"A": {"B": 5}, "B": {"C": 4}}
    """
    graph = {}
    routes = [i.strip() for i in graph_string.split(',')]
    for r in routes:
        start, end, weight = r
        weight = int(weight)
        if start not in graph:
            graph[start] = {end: weight}
        else:
            graph[start][end] = weight

    return graph