def bellman_distances(edges, distances, fLOG=None):
    """
    Computes shortest distances between all vertices.
    It assumes edges are symmetric.

    @param      edges           list of tuple (vertex A, vertex B)
    @param      distances       distances (list of floats)
    @param      fLOG            logging function
    @return                     dictionary of distances

    This function could be implemented based on
    `shortest_path <https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.csgraph.shortest_path.html>`_.
    """
    dist = {(a, b): d for d, (a, b) in zip(distances, edges)}
    dist.update({(b, a): d for d, (a, b) in zip(distances, edges)})
    dist0 = dist.copy()

    iter = 0  # pylint: disable=W0622
    up = dist
    while len(up) > 0:
        iter += 1
        up = {}
        for (a, b), d1 in dist.items():
            if (a, b) not in dist0 and (a, b) not in up:
                # no need to continue as no update during the last iteration
                continue
            for (aa, bb), d2 in dist.items():
                # not the most efficient
                if b == aa and a != bb:
                    d = d1 + d2
                    if (a, bb) not in dist or dist[a, bb] > d:
                        up[a, bb] = d
                        up[bb, a] = d
        dist.update(up)
        if fLOG:
            sum_values = sum(dist.values())
            mes = "iteration={0} modif={1} #dist={2} sum_values={3} avg={4}".format(
                iter, len(up), len(dist), sum_values, sum_values / len(dist))
            fLOG("[bellman_distances] " + mes)

    return dist