![]() |
Chemical Data Processing Library C++ API - Version 1.4.0
|
Computes 64-bit hash codes that are characteristic for the topology of a molecular graph and the properties of its atoms and bonds. More...
#include <HashCodeCalculator.hpp>
Classes | |
| class | DefAtomHashSeedFunctor |
| Default functor for the generation of atom hash seeds. More... | |
| class | DefBondHashSeedFunctor |
| Default functor for the generation of bond hash seeds. More... | |
Public Types | |
| typedef std::function< std::uint64_t(const Atom &)> | AtomHashSeedFunction |
| Type of the generic functor class used to store user-defined functions or function objects for the generation of initial atom hash codes. More... | |
| typedef std::function< std::uint64_t(const Bond &)> | BondHashSeedFunction |
| Type of the generic functor class used to store user-defined functions or function objects for the generation of initial bond hash codes. More... | |
Public Member Functions | |
| HashCodeCalculator () | |
Constructs the HashCodeCalculator instance. More... | |
| HashCodeCalculator (const MolecularGraph &molgraph) | |
Constructs the HashCodeCalculator instance and calculates the hash code of the molecular graph molgraph. More... | |
| HashCodeCalculator (const HashCodeCalculator &)=delete | |
| HashCodeCalculator & | operator= (const HashCodeCalculator &)=delete |
| void | setAtomHashSeedFunction (const AtomHashSeedFunction &func) |
| Allows to specify a custom function for the generation of initial atom hash codes. More... | |
| void | setBondHashSeedFunction (const BondHashSeedFunction &func) |
| Allows to specify a custom function for the generation of initial bond hash codes. More... | |
| std::uint64_t | calculate (const MolecularGraph &molgraph) |
| Calculates the hash code of the molecular graph molgraph. More... | |
| std::uint64_t | getResult () const |
| Returns the result of the last hash code calculation. More... | |
Static Public Attributes | |
| static constexpr unsigned int | DEF_ATOM_PROPERTY_FLAGS |
| Specifies the default set of atomic properties considered in the generation of initial atom hash codes by HashCodeCalculator::DefAtomHashSeedFunction. More... | |
| static constexpr unsigned int | DEF_BOND_PROPERTY_FLAGS |
| Specifies the default set of bond properties considered in the generation of initial bond hash codes by HashCodeCalculator::DefBondHashSeedFunction. More... | |
Computes 64-bit hash codes that are characteristic for the topology of a molecular graph and the properties of its atoms and bonds.
The algorithm assigns initial seeds to each atom and bond through the user-replaceable functors HashCodeCalculator::AtomHashSeedFunction and HashCodeCalculator::BondHashSeedFunction, iteratively propagates the seeds over the graph topology in the spirit of Morgan-style extended connectivity hashing, and finally folds the per-atom hash codes into a single 64-bit unsigned integer result via an SHA-style mixing step. The default seed functors (DefAtomHashSeedFunctor, DefBondHashSeedFunctor) take into account the property flags specified by the static constants DEF_ATOM_PROPERTY_FLAGS and DEF_BOND_PROPERTY_FLAGS, respectively.
| typedef std::function<std::uint64_t(const Atom&)> CDPL::Chem::HashCodeCalculator::AtomHashSeedFunction |
Type of the generic functor class used to store user-defined functions or function objects for the generation of initial atom hash codes.
Functions or function objects for the generation of atom hash seeds are required to take the atom (as a const reference to Chem::Atom) as argument and return the hash seed as an integer of type std::uint64_t (see [FUNWRP]).
| typedef std::function<std::uint64_t(const Bond&)> CDPL::Chem::HashCodeCalculator::BondHashSeedFunction |
Type of the generic functor class used to store user-defined functions or function objects for the generation of initial bond hash codes.
Functions or function objects for the generation of bond hash seeds are required to take the bond (as a const reference to Chem::Bond) as argument and return the hash seed as an integer of type std::uint64_t (see [FUNWRP]).
| CDPL::Chem::HashCodeCalculator::HashCodeCalculator | ( | ) |
Constructs the HashCodeCalculator instance.
| CDPL::Chem::HashCodeCalculator::HashCodeCalculator | ( | const MolecularGraph & | molgraph | ) |
Constructs the HashCodeCalculator instance and calculates the hash code of the molecular graph molgraph.
The calculated hash code can be retrieved by a call to getResult().
| molgraph | The molecular graph for which the hash code has to be calculated. |
|
delete |
|
delete |
| void CDPL::Chem::HashCodeCalculator::setAtomHashSeedFunction | ( | const AtomHashSeedFunction & | func | ) |
Allows to specify a custom function for the generation of initial atom hash codes.
| func | A HashCodeCalculator::AtomHashSeedFunction instance that wraps the target function. |
| void CDPL::Chem::HashCodeCalculator::setBondHashSeedFunction | ( | const BondHashSeedFunction & | func | ) |
Allows to specify a custom function for the generation of initial bond hash codes.
| func | A HashCodeCalculator::BondHashSeedFunction instance that wraps the target function. |
| std::uint64_t CDPL::Chem::HashCodeCalculator::calculate | ( | const MolecularGraph & | molgraph | ) |
Calculates the hash code of the molecular graph molgraph.
| molgraph | The molecular graph for which to calculate the hash code. |
| std::uint64_t CDPL::Chem::HashCodeCalculator::getResult | ( | ) | const |
Returns the result of the last hash code calculation.
|
staticconstexpr |
Specifies the default set of atomic properties considered in the generation of initial atom hash codes by HashCodeCalculator::DefAtomHashSeedFunction.
|
staticconstexpr |
Specifies the default set of bond properties considered in the generation of initial bond hash codes by HashCodeCalculator::DefBondHashSeedFunction.