undirgrafbug
authorjacint
Fri, 07 Jan 2005 08:40:13 +0000
changeset 1058dddb01f98796
parent 1057 4588f97ad91f
child 1059 bd97feae7d90
undirgrafbug
src/work/jacint/bug.cc
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/work/jacint/bug.cc	Fri Jan 07 08:40:13 2005 +0000
     1.3 @@ -0,0 +1,60 @@
     1.4 +//lasd megjegyzes a 49-es sorban
     1.5 +#include <iostream>
     1.6 +#include <queue>
     1.7 +#include <vector>
     1.8 +#include <math.h>
     1.9 +
    1.10 +#include <lemon/invalid.h>
    1.11 +#include <lemon/list_graph.h>
    1.12 +#include <matching.h>
    1.13 +
    1.14 +using namespace lemon;
    1.15 +
    1.16 +int main(int, char **) {
    1.17 +
    1.18 +  typedef UndirListGraph Graph;
    1.19 +
    1.20 +  typedef Graph::Edge Edge;
    1.21 +  typedef Graph::UndirEdgeIt UndirEdgeIt;
    1.22 +  typedef Graph::IncEdgeIt IncEdgeIt;
    1.23 +  typedef Graph::NodeIt NodeIt;
    1.24 +  typedef Graph::Node Node;
    1.25 +   
    1.26 +  Graph G;
    1.27 +
    1.28 +  G.clear();
    1.29 +  std::vector<Graph::Node> nodes;
    1.30 +  for (int i=0; i<5; ++i)
    1.31 +      nodes.push_back(G.addNode());
    1.32 +  G.addEdge(nodes[0], nodes[0]);
    1.33 +  G.addEdge(nodes[0], nodes[1]);
    1.34 +  G.addEdge(nodes[0], nodes[2]);  
    1.35 +  G.addEdge(nodes[0], nodes[4]);
    1.36 +  G.addEdge(nodes[2], nodes[3]);
    1.37 +  G.addEdge(nodes[1], nodes[2]);
    1.38 +  G.addEdge(nodes[2], nodes[4]);
    1.39 +
    1.40 +  for(UndirEdgeIt e(G); e!=INVALID; ++e) {
    1.41 +    std::cout<<G.id(e)<<" : "<<G.id(G.source(e))<<" " <<G.id(G.target(e))<<std::endl;
    1.42 +  }
    1.43 +
    1.44 +  std::cout <<"Nodes:"<<std::endl;
    1.45 +
    1.46 +  for(NodeIt v(G); v!=INVALID; ++v) {
    1.47 +    std::cout<<G.id(v)<<std::endl;
    1.48 +  }
    1.49 +
    1.50 +  for( IncEdgeIt f(G,nodes[1]); f!=INVALID; ++f ) {
    1.51 +    std::cout<<"edges " << G.id(f)<< " : " << G.id(G.target(f))<<std::endl;
    1.52 +  }//ez a ket for ciklus meg lefut - bar hibas eleken iteral -, de a matching.h-s mar segfaultol
    1.53 +
    1.54 +  for( IncEdgeIt f(G,nodes[1]); f!=INVALID; ++f ) {
    1.55 +    std::cout<<"edges " << G.id(f)<< " : " << G.id(G.target(f))<<std::endl;
    1.56 +  }
    1.57 +
    1.58 +  MaxMatching<Graph> max_matching(G);
    1.59 +  max_matching.runEdmonds(0);
    1.60 +  
    1.61 +  return 0;
    1.62 +}
    1.63 +