Hello,
I think the function all_shortest_paths is not returning the correct answer when the input parameter edges = True . I created 3 edges between 2 nodes. These edges have different attributes. 2 of them have the weight set to 200 and one of the edges weight is 100. As the diagram below shows. However, graph tool return an edge object but the attribute for edge object are not correct. You can see the example in python below.
- graph-tool version : 2.45 .
- Operating system : macOS Monterey 12.6.1.
- A minimal working example that shows the problem.
g = gt.Graph()
edge_weight = g.new_edge_property("double")
g.edge_properties["weight"] = edge_weight
edges = [[0,1],[0,1],[0,1]]
weights = [200,200,100]
for i in range(len(edges)):
e = g.add_edge(edges[i][0], edges[i][1])
g.ep.weight[e] = weights[i]
for path in gt.all_shortest_paths(g, 0, 1, weights=g.ep.weight, edges = True):
print(path)
for edge in path:
print(edge,g.ep.weight[edge])
For the above it will return:
[<Edge object with source '0' and target '1' at 0x1769584c0>]
(0, 1) 200.0
Which is wrong. I was expecting to see the edge with the weight 100. The good news is that it identifies the shortest path is one edge (not three) but it is not returning it right.