On 30.06.2017 18:44, François Kawala wrote: > I realize that I'm not familiar enough with boost to do this change. > > From what I get, I'll add three private members : _distance and _predecessor > they would be initialized as follows : > > _distance(get(vertex_distance, *_mg)), > _predecessor(get(predecessor, *_mg)), > > I don't know if the _distance member should be filled with zeros ? > > The last private member would be _reach a std::vector<size_t> > > From that I'll declare two functions : > > set_reached to update the reached vertices > reset_distance to reset the _distance, _predecessor and _reach to their > default values. > > Does that sounds right ? If so, I'll guess that I'll have to make > the do_djk_search function to call the set_reached and reset_distance > functions. > > Am I missing something ? > > Sorry for this stuttering approach.
I've just pushed a commit that implements what you want; you can look inside
for the details.
In short, you can now do multiple searches as follows:
dist_map = g.new_vp("double", numpy.inf) # must be infinity
pred_map = g.vertex_index.copy() # must be identity
for source in sources:
# the following does not initialize dist_map and pred_map, and
# returns an array of reached vertices
dist_map, pred_map, reached = \
shortest_distance(g, source, weights=w, pred_map=pred_map,
dist_map=dist_map, return_reached=True)
# reset property maps for next search; this is O(len(reached))
dist_map.a[reached] = numpy.inf
pred_map.a[reached] = reached
Please tell me if this brings the improvements you were seeking.
Best,
Tiago
signature.asc
Description: OpenPGP digital signature
_______________________________________________ graph-tool mailing list [email protected] https://lists.skewed.de/mailman/listinfo/graph-tool
