//This is just a simple example program to test my union-find structure

//#include <marciMap.hh>
#include <union_find.h>
#include <iostream>
#include <list_graph.hh>
using namespace hugo;
using namespace std;

int main (int, char*[])
{
  typedef ListGraph::NodeIt NodeIt;
  typedef ListGraph::EachNodeIt EachNodeIt;
  typedef ListGraph::EdgeIt EdgeIt;

  ListGraph flowG;

  
  //Marci példája



  NodeIt s=flowG.addNode();
  NodeIt v1=flowG.addNode();
  NodeIt v2=flowG.addNode();
  NodeIt v3=flowG.addNode();
  NodeIt v4=flowG.addNode();
  NodeIt t=flowG.addNode();

  ListGraph::NodeMap<int> component(flowG);

  component.set(s, -1);
  component.set(v1, -1);
  component.set(v2, -1);
  component.set(v3, -1);
  component.set(v4, -1);
  component.set(t, -1);

  UnionFind< NodeIt, ListGraph::NodeMap<int> > uf(component);
  cout<<"Merge s and v1: "<<uf.findAndMerge(s,v1)<<endl;
  cout<<"Merge s and v1: "<<uf.findAndMerge(s,v1)<<endl;
  cout<<"Merge s and v2: "<<uf.findAndMerge(s,v3)<<endl;
  for(EachNodeIt i=flowG.template first<EachNodeIt>(); i.valid(); ++i) {

    cout<<"Az "<<flowG.id(i)<<". pont itt van: "<<uf.find(i)<<endl;
    //std::cout << node_name.get(i) << ": ";
  }
}
