COIN-OR::LEMON - Graph Library

source: lemon-0.x/src/work/jacint/bug.cc @ 1058:dddb01f98796

Last change on this file since 1058:dddb01f98796 was 1058:dddb01f98796, checked in by jacint, 16 years ago

undirgrafbug

File size: 1.5 KB
Line 
1//lasd megjegyzes a 49-es sorban
2#include <iostream>
3#include <queue>
4#include <vector>
5#include <math.h>
6
7#include <lemon/invalid.h>
8#include <lemon/list_graph.h>
9#include <matching.h>
10
11using namespace lemon;
12
13int main(int, char **) {
14
15  typedef UndirListGraph Graph;
16
17  typedef Graph::Edge Edge;
18  typedef Graph::UndirEdgeIt UndirEdgeIt;
19  typedef Graph::IncEdgeIt IncEdgeIt;
20  typedef Graph::NodeIt NodeIt;
21  typedef Graph::Node Node;
22   
23  Graph G;
24
25  G.clear();
26  std::vector<Graph::Node> nodes;
27  for (int i=0; i<5; ++i)
28      nodes.push_back(G.addNode());
29  G.addEdge(nodes[0], nodes[0]);
30  G.addEdge(nodes[0], nodes[1]);
31  G.addEdge(nodes[0], nodes[2]); 
32  G.addEdge(nodes[0], nodes[4]);
33  G.addEdge(nodes[2], nodes[3]);
34  G.addEdge(nodes[1], nodes[2]);
35  G.addEdge(nodes[2], nodes[4]);
36
37  for(UndirEdgeIt e(G); e!=INVALID; ++e) {
38    std::cout<<G.id(e)<<" : "<<G.id(G.source(e))<<" " <<G.id(G.target(e))<<std::endl;
39  }
40
41  std::cout <<"Nodes:"<<std::endl;
42
43  for(NodeIt v(G); v!=INVALID; ++v) {
44    std::cout<<G.id(v)<<std::endl;
45  }
46
47  for( IncEdgeIt f(G,nodes[1]); f!=INVALID; ++f ) {
48    std::cout<<"edges " << G.id(f)<< " : " << G.id(G.target(f))<<std::endl;
49  }//ez a ket for ciklus meg lefut - bar hibas eleken iteral -, de a matching.h-s mar segfaultol
50
51  for( IncEdgeIt f(G,nodes[1]); f!=INVALID; ++f ) {
52    std::cout<<"edges " << G.id(f)<< " : " << G.id(G.target(f))<<std::endl;
53  }
54
55  MaxMatching<Graph> max_matching(G);
56  max_matching.runEdmonds(0);
57 
58  return 0;
59}
60 
Note: See TracBrowser for help on using the repository browser.