Artifact b584e6b7fe45956b44f542c7625d149871f335d2
- File
_lib/typical/bfs.cpp
- 2011-02-23 09:21:16 - part of checkin [4fd800b3a8] on branch trunk - Copied from private svn repository. (user: kinaba) [annotate]
- File
lib/typical/bfs.cpp
- 2011-02-23 11:18:09 - part of checkin [23dfcca431] on branch trunk - renamed _lib to lib (user: kinaba) [annotate]
// code template for BFS State start = /*start*/; vector<State> Q( 1, start ); set<State> V; V.insert(start); for(int step=0; !Q.empty(); ++step) { vector<State> Qold; Qold.swap(Q); for(int qi=0; qi<Qold.size(); ++qi) { State& cur = Qold[qi]; if( /*isGoal(cur)*/ ) { } foreach(next) { if( !V.count(next) ) { V.insert(next); Q.push_back(next); } } } }