Changes in the documentation.
6 #include <list_graph.h>
7 #include <smart_graph.h>
9 #include <time_measure.h>
10 #include <for_each_macros.h>
11 #include <bfs_iterator.h>
12 #include <graph_wrapper.h>
17 typedef UndirListGraph Graph;
18 typedef Graph::Node Node;
19 typedef Graph::NodeIt NodeIt;
20 typedef Graph::Edge Edge;
21 typedef Graph::EdgeIt EdgeIt;
22 typedef Graph::OutEdgeIt OutEdgeIt;
26 //Graph::EdgeMap<int> cap(g);
27 //readDimacsMaxFlow(std::cin, g, s, t, cap);
28 std::vector<Graph::Node> s_nodes;
29 std::vector<Graph::Node> t_nodes;
30 for (int i=0; i<3; ++i) s_nodes.push_back(g.addNode());
31 for (int i=0; i<3; ++i) t_nodes.push_back(g.addNode());
32 g.addEdge(s_nodes[0], t_nodes[2]);
33 g.addEdge(t_nodes[1], s_nodes[2]);
35 Graph::NodeMap<int> ref_map(g, -1);
36 IterableBoolMap< Graph::NodeMap<int> > bipartite_map(ref_map);
37 for (int i=0; i<3; ++i) bipartite_map.insert(s_nodes[i], false);
38 for (int i=0; i<3; ++i) bipartite_map.insert(t_nodes[i], true);
39 typedef BipartiteGraphWrapper<Graph> BGW;
40 BGW bgw(g, bipartite_map);
41 FOR_EACH_LOC(BGW::EdgeIt, e, bgw) {
42 std::cout << bgw.tail(e) << "->" << bgw.head(e) << std::endl;
44 // Graph::NodeMap<OutEdgeIt> pred(G);
48 // Graph::NodeMap<bool> reached(G);
49 // reached.set(s, true);
50 // pred.set(s, INVALID);
51 // std::queue<Node> bfs_queue;
53 // while (!bfs_queue.empty()) {
54 // Node v=bfs_queue.front();
57 // for(G.first(e,v); G.valid(e); G.next(e)) {
61 // reached.set(w, true);
67 // std::cout << ts << std::endl;
72 // BfsIterator< Graph, Graph::NodeMap<bool> > bfs(G);
73 // bfs.pushAndSetReached(s);
74 // pred.set(s, INVALID);
75 // while (!bfs.finished()) {
77 // if (G.valid(bfs) && bfs.isBNodeNewlyReached())
78 // pred.set(bfs.bNode(), bfs);
80 // std::cout << ts << std::endl;