RuntimeError (Edge filter is active / vertex filter is not)

Hello,

Since past couple days I encounter a new RuntimeError that I fail to
explain. See below the end of the error stack :

File "utils/graph.py", line 345, in multiple_shortest_path p =
graph.vertex(pred_map[v])
File "/usr/lib/python2.7/dist-packages/graph_tool/__init__.py", line 1777,
in vertex v = libcore.get_vertex(self.__graph, int(i), use_index)
RuntimeError: Edge filter is active but vertex filter is not. This is a bug.

This error is raised in a customized version of the
*graph_tool.topology.shortest_path *function. This function (named
multiple_shortest_path) is "optimized" to compute multiple shortest paths from
a source vertex to a set of targets. This function is presented below.

Would anybody have some hints on the reason of this intermittent error ?

Thanks,
F.

def multiple_shortest_path(graph, source, targets, distances, pred_map):
    """
    :param graph: a GraphTool.Graph instance.
    :param source: origin vertex id in *graph*
    :param targets: the vertices ids (in *graph*) for which we compute
the shortest paths
    :param distances: a property map that contains distances from
source vertex to each vertex
    :param* pred_map: a property map of predecessor computed by
graph_tool.shortest_distance*
    """
    # sort the targets from the farthest to the closest
    targets, _ = zip(*sorted([(graph.vertex(t), distances.a[t]) for t
in targets], key=lambda x: x[1]))

    vlists = {}

    for tgt in targets:

        if pred_map[tgt] == int(tgt) and tgt != source:
            # Ain't no path to target (should not happen, but better
safe than sorry)
            vlists[tgt] = []

        v = tgt
        vlist = [tgt]

        # we crawl back the predecessor map until the source is reached
        while v != source:

            # one step more toward the source
            p = graph.vertex(pred_map[v])

            if p in vlists:
                # we already know the shortest_path (avoid useless
crawl back to the source)
                vlist = vlists[p] + vlist
                v = graph.vertex(vlist[0])
            else:
                # saves the current step
                vlist.insert(0, p)
                # predecessor vertex becomes the current vertex
(recall we crawl back from target until source)
                v = p

        # Saves the vertices list from target to source (ie. the
shortest path wrt. the predecessor map)
        vlists[tgt] = vlist

    return vlists

attachment.html (7.37 KB)

This is most likely a bug, but it cannot have anything to do with the
function you sent, since it does not activate or deactivate graph
filtering.

Please provide a minimal but _complete_ script where the problem can be
seen.

Best,

Tiago