Changeset 549:5531429143bc in lemon-0.x for src/work/marci/bfs_dfs_misc.h
- Timestamp:
- 05/06/04 17:10:48 (21 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@722
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/work/marci/bfs_dfs_misc.h
r548 r549 20 20 if (!reached[n]) { 21 21 bfs.pushAndSetReached(n); 22 bool_map.set(n, false) { 23 while (!bfs.finished()) { 24 if (bfs.isBNodeNewlyReached()) { 25 bool_map.set(bfs.bNode())=!bfs.aNode(); 26 } else { 27 if (bool_map[bfs.bNode()]==bool_map[bfs.aNode()]) { 28 return false; 29 } 22 bool_map.set(n, false); 23 while (!bfs.finished()) { 24 if (bfs.isBNodeNewlyReached()) { 25 bool_map.set(bfs.bNode())=!bfs.aNode(); 26 } else { 27 if (bool_map[bfs.bNode()]==bool_map[bfs.aNode()]) { 28 return false; 30 29 } 31 ++bfs;32 30 } 31 ++bfs; 33 32 } 34 33 } 35 34 } 35 36 36 return true; 37 37 } … … 39 39 /// experimental topsort, 40 40 /// I think the final version will work as an iterator 41 /// if the graph is not a acyclic, the na pre-topological order is obtained 42 /// (see Schrijver's book) 41 43 template<typename Graph> 42 void topSort( Graph& g, std::list<typename Graph::Node>& l) {44 void topSort(const Graph& g, std::list<typename Graph::Node>& l) { 43 45 l.clear(); 44 46 typedef typename Graph::template NodeMap<bool> ReachedMap;
Note: See TracChangeset
for help on using the changeset viewer.