athos@250: //This is just a simple example program to test my union-find structure athos@250: athos@250: //#include <marciMap.hh> athos@250: #include <union_find.h> athos@250: #include <iostream> athos@250: #include <list_graph.hh> alpar@921: using namespace lemon; athos@250: using namespace std; athos@250: athos@250: int main (int, char*[]) athos@250: { athos@250: typedef ListGraph::NodeIt NodeIt; athos@250: typedef ListGraph::EachNodeIt EachNodeIt; athos@250: typedef ListGraph::EdgeIt EdgeIt; athos@250: athos@250: ListGraph flowG; athos@250: athos@250: athos@250: //Marci példája athos@250: athos@250: athos@250: athos@250: NodeIt s=flowG.addNode(); athos@250: NodeIt v1=flowG.addNode(); athos@250: NodeIt v2=flowG.addNode(); athos@250: NodeIt v3=flowG.addNode(); athos@250: NodeIt v4=flowG.addNode(); athos@250: NodeIt t=flowG.addNode(); athos@250: athos@250: ListGraph::NodeMap<int> component(flowG); athos@250: athos@250: component.set(s, -1); athos@250: component.set(v1, -1); athos@250: component.set(v2, -1); athos@250: component.set(v3, -1); athos@250: component.set(v4, -1); athos@250: component.set(t, -1); athos@250: athos@250: UnionFind< NodeIt, ListGraph::NodeMap<int> > uf(component); athos@250: cout<<"Merge s and v1: "<<uf.findAndMerge(s,v1)<<endl; athos@250: cout<<"Merge s and v1: "<<uf.findAndMerge(s,v1)<<endl; athos@250: cout<<"Merge s and v2: "<<uf.findAndMerge(s,v3)<<endl; athos@250: for(EachNodeIt i=flowG.template first<EachNodeIt>(); i.valid(); ++i) { athos@250: athos@250: cout<<"Az "<<flowG.id(i)<<". pont itt van: "<<uf.find(i)<<endl; athos@250: //std::cout << node_name.get(i) << ": "; athos@250: } athos@250: }