Home | Trees | Index | Help |
|
---|
Package NX :: Module search_class :: Class Search |
|
object
--+
|
Search
Forest
,
Length
,
Postorder
,
Predecessor
,
Preorder
,
Successor
Generic graph traversal (search) class.
Users should generally use the search functions defined below. e.g. to get a list of all nodes of G in breadth first search (BFS) order from v use
vertex_list=bfs_preorder(G,v)
To search the graph G from v do the following:
S=Search(G,queue=DFS) S.search(v=v)
Depending on the type of queue you will get a different traversal type.
You may use any of the following queues from the Queues class: Name Queue Traversal ----- ------ ---------- DFS LIFO Depth First Search BFS FIFO Breadth First Search Random Random Random search
The generic search produces no data and thus is of limited utility. Visitor callback functions are called at points along the search which may be used to store shortest path data
Method Summary | |
---|---|
__init__(self,
G,
queue)
| |
Visitor function called at the search end of each connected component. | |
Visitor function called the first time an edge is encountered. | |
Visitor function called the first time a vertex is encountered. | |
Visitor function called the last time an edge is encountered. | |
Visitor function called the last time a vertex is encountered. | |
Search the graph. | |
Visitor function called at the search start of each connected component. | |
Inherited from object :
__delattr__ ,
__getattribute__ ,
__hash__ ,
__new__ ,
__reduce__ ,
__reduce_ex__ ,
__repr__ ,
__setattr__ ,
__str__
|
Method Details |
---|
end_tree(self, v)Visitor function called at the search end of each connected component. |
firstseen_edge(self, e)Visitor function called the first time an edge is encountered. |
firstseen_vertex(self, v)Visitor function called the first time a vertex is encountered. |
lastseen_edge(self, e)Visitor function called the last time an edge is encountered. |
lastseen_vertex(self, v)Visitor function called the last time a vertex is encountered. |
search(self, v=None)Search the graph. The search method is deteremined by the initialization of the search object. The optional v= argument can be a single vertex a list or None. v=v: search the component of G reachable from v v=vlist: search the component of G reachable from v v=None: search the entire graph G even if it isn't connected Call visitor functions along the way. |
start_tree(self, v)Visitor function called at the search start of each connected component. |
Home | Trees | Index | Help |
|
---|
Generated by Epydoc 2.1 on Mon Apr 11 10:59:20 2005 | http://epydoc.sf.net |