equal
deleted
inserted
replaced
77 std::cout<<std::endl; |
77 std::cout<<std::endl; |
78 ++bfs; |
78 ++bfs; |
79 } |
79 } |
80 } |
80 } |
81 |
81 |
|
82 { |
|
83 std::cout << "iterator dfs demo 4 ..." << std::endl; |
|
84 DfsIterator4< ListGraph, ListGraph::OutEdgeIt, ListGraph::NodeMap<bool> > dfs(G); |
|
85 dfs.pushAndSetReached(s); |
|
86 while (!dfs.finished()) { |
|
87 ++dfs; |
|
88 if (OutEdgeIt(dfs).valid()) { |
|
89 std::cout << "OutEdgeIt: " << dfs; |
|
90 std::cout << " aNode: " << G.aNode(dfs); |
|
91 std::cout << " bNode: " << G.bNode(dfs) << " "; |
|
92 } else { |
|
93 std::cout << "OutEdgeIt: " << "invalid"; |
|
94 std::cout << " aNode: " << dfs.aNode(); |
|
95 std::cout << " bNode: " << "invalid" << " "; |
|
96 } |
|
97 if (dfs.isBNodeNewlyReached()) { |
|
98 std::cout << "bNodeIsNewlyReached "; |
|
99 } else { |
|
100 std::cout << "bNodeIsNotNewlyReached "; |
|
101 } |
|
102 if (dfs.isANodeExamined()) { |
|
103 std::cout << "aNodeIsExamined "; |
|
104 } else { |
|
105 std::cout << "aNodeIsNotExamined "; |
|
106 } |
|
107 std::cout<<std::endl; |
|
108 //++dfs; |
|
109 } |
|
110 } |
|
111 |
|
112 |
82 typedef ConstTrivGraphWrapper<ListGraph> CTGW; |
113 typedef ConstTrivGraphWrapper<ListGraph> CTGW; |
83 CTGW wG(G); |
114 CTGW wG(G); |
84 |
115 |
85 std::cout << "bfs and dfs demo on the directed graph" << std::endl; |
116 std::cout << "bfs and dfs demo on the directed graph" << std::endl; |
86 for(CTGW::EachNodeIt i=wG.first<CTGW::EachNodeIt>(); i.valid(); ++i) { |
117 for(CTGW::EachNodeIt i=wG.first<CTGW::EachNodeIt>(); i.valid(); ++i) { |