Graph displayer is now displaying nodes. Edges remain still undisplayed yet.
1 //This is just a simple example program to test my union-find structure
3 //#include <marciMap.hh>
4 #include <union_find.h>
6 #include <list_graph.hh>
10 int main (int, char*[])
12 typedef ListGraph::NodeIt NodeIt;
13 typedef ListGraph::EachNodeIt EachNodeIt;
14 typedef ListGraph::EdgeIt EdgeIt;
23 NodeIt s=flowG.addNode();
24 NodeIt v1=flowG.addNode();
25 NodeIt v2=flowG.addNode();
26 NodeIt v3=flowG.addNode();
27 NodeIt v4=flowG.addNode();
28 NodeIt t=flowG.addNode();
30 ListGraph::NodeMap<int> component(flowG);
33 component.set(v1, -1);
34 component.set(v2, -1);
35 component.set(v3, -1);
36 component.set(v4, -1);
39 UnionFind< NodeIt, ListGraph::NodeMap<int> > uf(component);
40 cout<<"Merge s and v1: "<<uf.findAndMerge(s,v1)<<endl;
41 cout<<"Merge s and v1: "<<uf.findAndMerge(s,v1)<<endl;
42 cout<<"Merge s and v2: "<<uf.findAndMerge(s,v3)<<endl;
43 for(EachNodeIt i=flowG.template first<EachNodeIt>(); i.valid(); ++i) {
45 cout<<"Az "<<flowG.id(i)<<". pont itt van: "<<uf.find(i)<<endl;
46 //std::cout << node_name.get(i) << ": ";