AStarVisitor#
- class graph_tool.search.AStarVisitor[source]#
Bases:
object
A 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
CLOSED
list is "rediscovered" via a more efficient path, and is re-added to theOPEN
list.This is invoked when a vertex is first discovered and is added to the
OPEN
list.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
OPEN
list).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 invoked on every vertex of the graph before the start of the graph search.
- black_target(e)[source]#
This is invoked when a vertex that is on the
CLOSED
list is “rediscovered” via a more efficient path, and is re-added to theOPEN
list.
- discover_vertex(u)[source]#
This is invoked when a vertex is first discovered and is added to the
OPEN
list.
- edge_not_relaxed(e)[source]#
Upon examination, if the edge is not relaxed (see
edge_relaxed()
) then this method is invoked.
- edge_relaxed(e)[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_vertex(u)[source]#
This is invoked on a vertex as it is popped from the queue (i.e. it has the lowest cost on the
OPEN
list). This happens immediately before examine_edge() is invoked on each of the out-edges of vertex u.