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