Commit 6f0c58fe authored by Tiago Peixoto's avatar Tiago Peixoto
Browse files

Fix bug with perfect_prop_hash()

parent c2825ffb
...@@ -39,7 +39,7 @@ struct do_perfect_vhash ...@@ -39,7 +39,7 @@ struct do_perfect_vhash
{ {
typedef typename property_traits<VertexPropertyMap>::value_type val_t; typedef typename property_traits<VertexPropertyMap>::value_type val_t;
typedef typename property_traits<HashProp>::value_type hash_t; typedef typename property_traits<HashProp>::value_type hash_t;
typedef unordered_map<val_t, hash_t> dict_t; typedef std::unordered_map<val_t, hash_t> dict_t;
if (adict.empty()) if (adict.empty())
adict = dict_t(); adict = dict_t();
...@@ -52,9 +52,14 @@ struct do_perfect_vhash ...@@ -52,9 +52,14 @@ struct do_perfect_vhash
auto iter = dict.find(val); auto iter = dict.find(val);
hash_t h; hash_t h;
if (iter == dict.end()) if (iter == dict.end())
h = dict[val] = dict.size() - 1; {
h = dict.size();
dict[val] = h;
}
else else
{
h = iter->second; h = iter->second;
}
hprop[v] = h; hprop[v] = h;
} }
} }
......
...@@ -52,9 +52,14 @@ struct do_perfect_ehash ...@@ -52,9 +52,14 @@ struct do_perfect_ehash
auto iter = dict.find(val); auto iter = dict.find(val);
hash_t h; hash_t h;
if (iter == dict.end()) if (iter == dict.end())
h = dict[val] = dict.size() - 1; {
h = dict.size();
dict[val] = h;
}
else else
{
h = iter->second; h = iter->second;
}
hprop[e] = h; hprop[e] = h;
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment