AStarVisitor#
- class graph_tool.search.AStarVisitor[git][source]#
Bases:
objectA visitor object that is invoked at the event-points inside the
astar_search()algorithm. By default, it performs no action, and should be used as a base class in order to be useful.Methods
black_target(e)This is invoked when a vertex that is on the
CLOSEDlist is "rediscovered" via a more efficient path, and is re-added to theOPENlist.This is invoked when a vertex is first discovered and is added to the
OPENlist.Upon examination, if the edge is not relaxed (see
edge_relaxed()) then this method is invoked.edge_relaxed(e)Upon examination, if the following condition holds then the edge is relaxed (its distance is reduced), and this method is invoked.
examine_edge(e)This is invoked on every out-edge of each vertex after it is examined.
This is invoked on a vertex as it is popped from the queue (i.e. it has the lowest cost on the
OPENlist).This is invoked on a vertex when it is added to the CLOSED list, which happens after all of its out edges have been examined.
This is never invoked, since
astar_search()always starts from a source vertex and visits only the vertices reachable from it.- black_target(e)[git][source]#
This is invoked when a vertex that is on the
CLOSEDlist is “rediscovered” via a more efficient path, and is re-added to theOPENlist.
- discover_vertex(u)[git][source]#
This is invoked when a vertex is first discovered and is added to the
OPENlist.
- edge_not_relaxed(e)[git][source]#
Upon examination, if the edge is not relaxed (see
edge_relaxed()) then this method is invoked.
- edge_relaxed(e)[git][source]#
Upon examination, if the following condition holds then the edge is relaxed (its distance is reduced), and this method is invoked.
(u, v) = tuple(e) assert compare(combine(d[u], weight[e]), d[v])
- examine_edge(e)[git][source]#
This is invoked on every out-edge of each vertex after it is examined.
- examine_vertex(u)[git][source]#
This is invoked on a vertex as it is popped from the queue (i.e. it has the lowest cost on the
OPENlist). This happens immediately before examine_edge() is invoked on each of the out-edges of vertex u.
- finish_vertex(u)[git][source]#
This is invoked on a vertex when it is added to the CLOSED list, which happens after all of its out edges have been examined.
- initialize_vertex(u)[git][source]#
This is never invoked, since
astar_search()always starts from a source vertex and visits only the vertices reachable from it. (The distances of the other vertices are initialized internally, except withimplicit=True.)