COIN-OR::LEMON - Graph Library

source: lemon-0.x/src/work/jacint/bug.cc @ 1059:bd97feae7d90

Last change on this file since 1059:bd97feae7d90 was 1059:bd97feae7d90, checked in by jacint, 20 years ago
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  std::cout<<"Edges of node " << G.id(nodes[1])<<std::endl;
48
49  for( IncEdgeIt f(G,nodes[1]); f!=INVALID; ++f ) {
50    std::cout<<"edge " << G.id(f)<< " goes to " << G.id(G.target(f))<<std::endl;
51  }//ez a ket for ciklus meg lefut - bar hibas eleken iteral -, de a matching.h-s mar segfaultol
52
53  for( IncEdgeIt f(G,nodes[1]); f!=INVALID; ++f ) {
54    std::cout<<"edge " << G.id(f)<< " goes to " << G.id(G.target(f))<<std::endl;
55  }
56
57  MaxMatching<Graph> max_matching(G);
58  max_matching.runEdmonds(0);
59 
60  return 0;
61}
62 
Note: See TracBrowser for help on using the repository browser.