EpsWin and DesignWin does not need to know NoteBookTab.
3 * This file is a part of LEMON, a generic C++ optimization library
5 * Copyright (C) 2003-2006
6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
7 * (Egervary Research Group on Combinatorial Optimization, EGRES).
9 * Permission to use, modify and distribute this software is granted
10 * provided that this copyright notice appears in all copies. For
11 * precise terms see the accompanying LICENSE file.
13 * This software is provided "AS IS" with no warranty of any kind,
14 * express or implied, and with no claim as to its suitability for any
19 #include <lemon/kruskal.h>
21 #include <mapstorage.h>
22 #include <mapselector.h>
24 #include <kruskalbox.h>
26 enum {INPUT, OUTPUT, MAP_NUM};
28 KruskalBox::KruskalBox(std::vector<std::string> t):AlgoBox()
33 void KruskalBox::run()
36 tabcbt.get_active_text()!="" &&
37 (edgemapcbts[INPUT])->get_active_text()!="" &&
38 (edgemapcbts[OUTPUT])->get_active_text()!=""
42 const Graph &g=mapstorage->graph;
43 Graph::EdgeMap<double> * inputmap=
44 ((mapstorage->edgemap_storage)[(edgemapcbts[INPUT])->get_active_text()]);
45 Graph::EdgeMap<bool> outputmap(g);
46 double res=kruskal(g, *inputmap, outputmap);
48 for (EdgeIt i(g); i!=INVALID; ++i)
52 (*((mapstorage->edgemap_storage)[(edgemapcbts[OUTPUT])->
53 get_active_text()]))[i]=1;
57 (*((mapstorage->edgemap_storage)[(edgemapcbts[OUTPUT])->
58 get_active_text()]))[i]=0;
63 o << "Result: " << res;
64 resultlabel.set_text(o.str());
66 mapstorage->mapChanged(true, (edgemapcbts[OUTPUT])->get_active_text());
67 // mapstorage->changeActiveMap(true, E_COLOR,
68 // (edgemapcbts[OUTPUT])->get_active_text());
69 // mapstorage->changeActiveMap(true, E_TEXT,
70 // (edgemapcbts[INPUT])->get_active_text());
75 void KruskalBox::build_box()
77 std::vector<std::string> empty_vector;
79 addMapSelector("Edgecosts: ", true);
80 addMapSelector("Edges of tree here: ", true);
82 resultlabel.set_text("Result: algorithm is not run yet.");
83 pack_start(resultlabel);