#include #include #include #include #include using namespace std; using namespace hugo; class string_int_map : public map { public: int get(const string &s) { // Bocs, ez igy gaaaany, de nem volt kedvem utananezni, hogy // hogy is mukodik ez a map :) if( count(s) == 0 ) { operator[](s) = -1; } return operator[](s); } void set(const string &s, int i) { operator[](s) = i; } }; int main() { typedef ListGraph::NodeIt NodeIt; typedef ListGraph::EdgeIt EdgeIt; typedef ListGraph::EachNodeIt EachNodeIt; typedef ListGraph::EachEdgeIt EachEdgeIt; ListGraph G; NodeIt s=G.addNode(); NodeIt v1=G.addNode(); NodeIt v2=G.addNode(); NodeIt v3=G.addNode(); NodeIt v4=G.addNode(); NodeIt t=G.addNode(); G.addEdge(s, v1); G.addEdge(s, v2); G.addEdge(v1, v2); G.addEdge(v2, v1); G.addEdge(v1, v3); G.addEdge(v3, v2); G.addEdge(v2, v4); G.addEdge(v4, v3); G.addEdge(v3, t); G.addEdge(v4, t); ListGraph::EdgeMap edge_cost_map(G, 2); ListGraph::EdgeMap tree_map(G); double k0lts = MinCostTreeKruskal(G, edge_cost_map, tree_map); cout << k0lts << endl; return 0; }