On 07/06/2014 09:56 PM, Gareth Simons wrote:
I am using the shortest_distance method with a starting point vertex and a maximum search distance. When returning the results, the vertices outside of the maximum distance threshold are returned as maximum 64bit float numbers (1.79769313486e+308), presumably converted from Numpy’s internal positive infinity value.
This is not infinity, it is the maximum possible double.
Is there a way to return the array with numpy’s positive infinity value intact so that I can use the numpy.isposinf method to directly convert the array into a boolean format which I can then use for masking the graph?
There is no need to use "inf" (it would not work with integrals anyway). You can just use array operations to achieve the same thing: d = shortest_distance(g, source, max_dist=max_dist) mask = d.a <= max_dist u = GraphView(g, vfilt=mask) Best, Tiago -- Tiago de Paula Peixoto <tiago@skewed.de>