def dijkstra(G, start, weight='weight'):
    """
    Compute shortest path length between satrt
    and all other reachable nodes for a weight graph.
    return -> ({vertex: weight form start, }, {vertex: predeseccor, })
    """
    if start not in G.vertices:
        raise GraphInsertError("Vertex %s doesn't exist." % (start,))
    visited = {start: 0}
    path = {}
    vertices = set(G.vertices.keys())
    while vertices:
        min_vertex = None
        for vertex in vertices:
            if vertex in visited:
                if min_vertex is None or visited[vertex] < visited[min_vertex]:
                    min_vertex = vertex
        if min_vertex is None:
            break
        vertices.remove(min_vertex)
        current_weight = visited[min_vertex]
        for edge in G.vertices[min_vertex]:
            edge_weight = current_weight + G.edges[(min_vertex, edge)][weight]
            if edge not in visited or edge_weight < visited[edge]:
                visited[edge] = edge_weight
                path[edge] = min_vertex
    return visited, path
Compute shortest path length between satrt
    and all other reachable nodes for a weight graph.
    return -> ({vertex: weight form start, }, {vertex: predeseccor, })