Changing first to iterators.
6 #include <lemon/invalid.h>
7 #include <lemon/list_graph.h>
8 #include <lemon/smart_graph.h>
11 using namespace lemon;
17 typedef UndirSmartGraph Graph;
19 typedef Graph::Edge Edge;
20 typedef Graph::UndirEdgeIt UndirEdgeIt;
21 typedef Graph::IncEdgeIt IncEdgeIt;
22 typedef Graph::NodeIt NodeIt;
23 typedef Graph::Node Node;
25 typedef Graph::OutEdgeIt OutEdgeIt;
30 std::vector<Graph::Node> nodes;
31 for (int i=0; i<5; ++i)
32 nodes.push_back(G.addNode());
33 G.addEdge(nodes[0], nodes[0]);
34 G.addEdge(nodes[0], nodes[1]);
35 G.addEdge(nodes[0], nodes[2]);
36 G.addEdge(nodes[0], nodes[4]);
37 G.addEdge(nodes[2], nodes[3]);
38 G.addEdge(nodes[1], nodes[2]);
39 G.addEdge(nodes[2], nodes[4]);
41 for(UndirEdgeIt e(G); e!=INVALID; ++e) {
42 std::cout<<G.id(e)<<" : "<<G.id(G.source(e))
43 <<" " <<G.id(G.target(e))<<std::endl;
46 std::cout <<"Nodes:"<<std::endl;
48 for(NodeIt v(G); v!=INVALID; ++v) {
49 std::cout<<G.id(v)<<std::endl;
52 cout << "Dev Out edges from node " << G.id(nodes[1])<<std::endl;
54 for(G.firstOut(f, nodes[1]); f!=INVALID; G.nextOut(f)) {
55 cout<<"edge " << G.id(f) << " goes"
56 <<" from "<< G.id(G.source(f))
57 << " to " << G.id(G.target(f))<<std::endl;
60 cout << "Out edges from node " << G.id(nodes[1])<<std::endl;
61 for( OutEdgeIt f(G,nodes[1]); f!=INVALID; ++f ) {
62 cout<<"edge " << G.id(f) << " goes"
63 <<" from "<< G.id(G.source(f))
64 << " to " << G.id(G.target(f))<<std::endl;
67 std::cout<<"Edges of node " << G.id(nodes[1])<<std::endl;
68 for( IncEdgeIt f(G,nodes[1]); f!=INVALID; ++f ) {
69 cout<<"edge " << G.id(f) << " goes"
70 <<" from "<< G.id(G.source(f))
71 << " to " << G.id(G.target(f))<<std::endl;
76 //ez a ket for ciklus meg lefut - bar hibas eleken iteral -, de a
77 //matching.h-s mar segfaultol
79 for( IncEdgeIt f(G,nodes[1]); f!=INVALID; ++f ) {
80 std::cout<<"edge " << G.id(f)<< " goes to " << G.id(G.target(f))<<std::endl;
83 MaxMatching<Graph> max_matching(G);
84 max_matching.runEdmonds(0);