1 #include <kruskalbox.h>
3 enum {INPUT, OUTPUT, MAP_NUM};
5 KruskalBox::KruskalBox(std::vector<std::string> t):AlgoBox()
10 void KruskalBox::run()
13 tabcbt.get_active_text()!="" &&
14 (edgemapcbts[INPUT])->get_active_text()!="" &&
15 (edgemapcbts[OUTPUT])->get_active_text()!=""
19 Graph g=mapstorage->graph;
20 Graph::EdgeMap<double> * inputmap=
21 ((mapstorage->edgemap_storage)[(edgemapcbts[INPUT])->get_active_text()]);
22 Graph::EdgeMap<bool> outputmap(g);
23 double res=kruskal(g, *inputmap, outputmap);
25 for (EdgeIt i(g); i!=INVALID; ++i)
29 (*((mapstorage->edgemap_storage)[(edgemapcbts[OUTPUT])->
30 get_active_text()]))[i]=1;
34 (*((mapstorage->edgemap_storage)[(edgemapcbts[OUTPUT])->
35 get_active_text()]))[i]=0;
40 o << "Result: " << res;
41 resultlabel.set_text(o.str());
43 mapstorage->mapChanged(true, (edgemapcbts[OUTPUT])->get_active_text());
44 // mapstorage->changeActiveMap(true, E_COLOR,
45 // (edgemapcbts[OUTPUT])->get_active_text());
46 // mapstorage->changeActiveMap(true, E_TEXT,
47 // (edgemapcbts[INPUT])->get_active_text());
52 void KruskalBox::build_box()
54 std::vector<std::string> empty_vector;
56 addMapSelector("Edgecosts: ", true);
57 addMapSelector("Edges of tree here: ", true);
59 resultlabel.set_text("Result: algorithm is not run yet.");
60 pack_start(resultlabel);