graph_wrappers ...
    11 // Egy binaris kupac, ami stringekhez rendelt double ertekeket tarol,
 
    12 // azaz mindig az a string van a tetejen, amihez a legkisebb szam tartozik.
 
    13 // A kupac egy string_int_map tipusu property_map segitsegevel tarolja
 
    14 // a stringek aktualis helyet sajatmagan belul.
 
    15 // Egy olyan stringhez, ami meg nincsen a kupac -1 -et kell rendelnunk.
 
    16 typedef BinHeap<string, double, string_int_map> StrDoubleHeap;
 
    18 class string_int_map : public map<string,int> {
 
    19   typedef map<string,int> parent;
 
    21   int get(const string &s) {
 
    22     // Bocs, ez igy gaaaany, de nem volt kedvem utananezni, hogy
 
    23     // hogy is mukodik ez a map :)
 
    25       parent::operator[](s) = StrDoubleHeap::PRE_HEAP;
 
    27     return parent::operator[](s);
 
    29   int operator[](const string &s) {
 
    32   void set(const string &s, int i) {
 
    33       parent::operator[](s) = i;
 
    43   cout << "testing string_int_map default value:\n";
 
    44   cout << "  sim.get(\"alma\"): " << sim.get("alma") << endl;
 
    45   cout << "  sim[\"alma\"]: " << sim["alma"] << endl;
 
    47   cout << "creating the heap\n";
 
    48   StrDoubleHeap heap(sim);
 
    50   cout << "heap.push(\"alma\", 15);\n";
 
    51   heap.push("alma", 15);
 
    53   cout << "heap.set(\"korte\", 3.4);\n";
 
    54   heap.set("korte", 3.4);
 
    56   cout << "heap[\"alma\"] = " 
 
    60   cout << "heap.top() = "
 
    61        << heap.top() << endl;
 
    62   cout << "heap.prio() = "
 
    63        << heap.prio() << endl;
 
    65   cout << "heap.decrease(\"alma\", 1.2);\n";
 
    66   heap.set("alma", 1.2);
 
    68   cout << "heap.top() = "
 
    69        << heap.top() << endl;
 
    70   cout << "heap.prio() = "
 
    71        << heap.prio() << endl;
 
    73   cout << "heap.set(\"alma\", 22);\n";
 
    76   cout << "heap.top() = "
 
    77        << heap.top() << endl;
 
    78   cout << "heap.prio() = "
 
    79        << heap.prio() << endl;
 
    81   cout << "heap.size() = "
 
    82        << heap.size() << endl;
 
    83   cout << "heap.pop();\n";
 
    86   cout << "heap.top() = "
 
    87        << heap.top() << endl;
 
    88   cout << "heap.prio() = "
 
    89        << heap.prio() << endl;
 
    91   cout << "heap.state(\"szilva\") = "
 
    92        << heap.state("szilva") << endl;
 
    93   cout << "heap.set(\"szilva\", 0.5);\n";
 
    94   heap.set("szilva", 0.5);
 
    95   cout << "heap.state(\"szilva\") = "
 
    96        << heap.state("szilva") << endl;
 
    97   cout << "heap.top() = "
 
    98        << heap.top() << endl;
 
    99   cout << "heap.pop();\n";
 
   101   cout << "heap.state(\"szilva\") = "
 
   102        << heap.state("szilva") << endl;
 
   104   cout << "heap.size() = "
 
   105        << heap.size() << endl;
 
   106   cout << "heap.pop();\n";
 
   109   cout << "heap.size() = "
 
   110        << heap.size() << endl;  
 
   111   cout << "heap.empty() = "
 
   112        << (heap.empty()?"true":"false") << endl;