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