Apply Second Reduction Rule inside of Builder #410
Labels
✨ feature
New operation or other feature
question
Further information is requested
🎓 student programmer
Work, work...
🎓 student project
Work, work... but academic!
Milestone
Right now, the
bdd_builder
andzdd_builder
do not account for the user generating the same node twice.Implement a Hash Table
levelized_hash_table<ElemType, Hash = std::hash>
template that internally stores values in atpie::array
. It should support the following functionsinsert(ElemType e, size_t hash_value)
Insert e based on the precomputed hash hash_value for e. Note, if we find a node from a previous level, then we can safely overwrite it! At this point, we know we have reached the end of this bucket (for the current level).
insert(elem_t e)
Compute
Hash(e)
and use it to place it in the table with the above function.find(elem_t e, size_t hash_value)
/find(elem_t e)
Finds the index where e resides (-1 if it does not).
size()
Number of entries, which should be reset to 1 when inserting nodes for a new level.
current_level()
Returns the level of the latest inserted element. Returns
-1
if nothing has been pushed.capacity()
Return the size of the number of elements that fit into the internal
tpie::array
.Alternatively, this can be done by reusing the (leaky) computation cache from #444 . But, I would favour the above computation cache as it is levelized.
Hashing Nodes
std::hash
.Using the Hash Table
builder_ptr
also carry its hash value (and its negated hash value, if complement edges are supported) as part of its shared state. That is, the boolean inshared_ptr<bool> unreferenced
should be generalised to a structbuilder_ptr_shared
that has the unreferenced boolean, the uid and its hash values. Alternatively, it might be prettier to just swap the order between theshared_ptr
and thebuilder_ptr
, i.e. the end user getsshared_ptr<builder_ptr>
(renamed toshared_ptr<builder_node>
which is aliased asbuilder_ptr
)shared_ptr<...>
with the one in Use TPIE allocation inside of 'std::shared_pointer' #175 .builder
template withshared_ptr<builder_ptr_shared>
elements.builder_ptr
using the given shared state.shared_ptr
) then it can be deleted.If the cache-size is set to 0, then it works just as it always did. I'm not sure of yet, whether this or the maximum possible should be the default value.
The text was updated successfully, but these errors were encountered: