![]() |
Chemical Data Processing Library Python API - Version 1.4.0
|
Computes a 64-bit hash code that identifies a molecular graph up to a configurable set of atom and bond properties. More...
Inheritance diagram for CDPL.Chem.HashCodeCalculator:Classes | |
| class | DefAtomHashSeedFunctor |
| The default functor for the generation of atom hash seeds. More... | |
| class | DefBondHashSeedFunctor |
| The default functor for the generation of bond hash seeds. More... | |
Public Member Functions | |
| None | __init__ () |
Constructs the HashCodeCalculator instance. | |
| None | __init__ (MolecularGraph molgraph) |
Constructs the HashCodeCalculator instance and calculates the hash code of the molecular graph molgraph. More... | |
| int | getObjectID () |
| Returns the numeric identifier (ID) of the wrapped C++ class instance. More... | |
| None | setAtomHashSeedFunction (SizeTypeAtomFunctor func) |
| Allows to specify a custom function for the generation of initial atom hash codes. More... | |
| None | setBondHashSeedFunction (UInt64BondFunctor func) |
| Allows to specify a custom function for the generation of initial bond hash codes. More... | |
| int | calculate (MolecularGraph molgraph) |
| Calculates the hash code of the molecular graph molgraph. More... | |
| int | getResult () |
| Returns the result of the last hash code calculation. More... | |
| int | __call__ (MolecularGraph molgraph) |
Static Public Attributes | |
| int | DEF_ATOM_PROPERTY_FLAGS = 159 |
| Specifies the default set of atomic properties considered in the generation of initial atom hash codes by HashCodeCalculator.DefAtomHashSeedFunction. | |
| int | DEF_BOND_PROPERTY_FLAGS = 15 |
| Specifies the default set of bond properties considered in the generation of initial bond hash codes by HashCodeCalculator.DefBondHashSeedFunction. | |
Properties | |
| objectID = property(getObjectID) | |
| result = property(getResult) | |
Computes a 64-bit hash code that identifies a molecular graph up to a configurable set of atom and bond properties.
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 std::uint64_t result via an SHA-style mixing step. The default seed functors (DefAtomHashSeedFunctor, DefBondHashSeedFunctor) take into account the property flags combined into DEF_ATOM_PROPERTY_FLAGS and DEF_BOND_PROPERTY_FLAGS, respectively.
| None CDPL.Chem.HashCodeCalculator.__init__ | ( | 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. |
| int CDPL.Chem.HashCodeCalculator.getObjectID | ( | ) |
Returns the numeric identifier (ID) of the wrapped C++ class instance.
Different Python HashCodeCalculator instances may reference the same underlying C++ class instance. The commonly used Python expression a is not b thus cannot tell reliably whether the two HashCodeCalculator instances a and b reference different C++ objects. The numeric identifier returned by this method allows to correctly implement such an identity test via the simple expression a.getObjectID() != b.getObjectID().
| None CDPL.Chem.HashCodeCalculator.setAtomHashSeedFunction | ( | SizeTypeAtomFunctor | 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. |
| None CDPL.Chem.HashCodeCalculator.setBondHashSeedFunction | ( | UInt64BondFunctor | 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. |
| int CDPL.Chem.HashCodeCalculator.calculate | ( | MolecularGraph | molgraph | ) |
Calculates the hash code of the molecular graph molgraph.
| molgraph | The molecular graph for which to calculate the hash code. |
| int CDPL.Chem.HashCodeCalculator.getResult | ( | ) |
Returns the result of the last hash code calculation.
| int CDPL.Chem.HashCodeCalculator.__call__ | ( | MolecularGraph | molgraph | ) |
| molgraph |