Hello,
I want to try graph-tool because it seems a very powerful and fast way to work with graphs in python.
I installed it with the pre-compiled package for ubuntu 14.04 on a 32 bit machine. I tested this code
from graph_tool.all import *
g = Graph()
v1 = g.add_vertex()
v2 = g.add_vertex()
v3 = g.add_vertex()
v4 = g.add_vertex()
v5 = g.add_vertex()
e1 = g.add_edge(v1, v5)
e2 = g.add_edge(v2, v3)
e3 = g.add_edge(v3, v4)
e4 = g.add_edge(v4, v2)
e5 = g.add_edge(v4, v5)
e6 = g.add_edge(v4, v1)
weights = g.new_edge_property("int")
weights[e1] = 2
weights[e2] = 3
weights[e3] = 2
weights[e4] = -1
weights[e5] = 5
weights[e6] = 1
minimized, dist, pred = bellman_ford_search(g, g.vertex(0), weights)
and what I get is:
File "/usr/lib/python2.7/dist-packages/graph_tool/search/__init__.py", line 1118, in bellman_ford_search
zero, infinity)
OverflowError: Python int too large to convert to C long.
In case I add the infinity parameter, so minimized, dist, pred = bellman_ford_search(g, g.vertex(0), weights, infinity=int)
I get
File "graphTest2.py", line 26, in <module>
minimized, dist, pred = bellman_ford_search(g, g.vertex(0), weights, infinity=int)
File "/usr/lib/python2.7/dist-packages/graph_tool/search/__init__.py", line 1103, in bellman_ford_search
infinity = _python_type(dist_map.value_type())(infinity)
TypeError: descriptor '__trunc__' of 'int' object needs an argument
and the same happens with infinity=float.
I tested dijkstra_search, that uses infinity as well, but I don't get any problem.
Could you please tell me if I am doing something wrong, or if there is a problem?
Thanks and best regards,
Alessandro