Measures for the similarity of molecules are of interest for several in silico based tasks like virtual screening or de novo structure design. The Optimal Assignment Kernel (OAK) [1] is a successful similarity measure, although it is not a valid kernel, since the function is not positive definite [2]. Careful investigations of the assignment on the atom level disclose that the optimal assignment with the Hungarian algorithm may result in topological errors. These errors are mappings of atoms from chemical substructures like ring systems to atoms of the other molecule, which belong to different substructures or even can be scattered among the molecule. This yields an overall higher similarity score but is problematic from a chemical point of view. To avoid these topological errors we developed a two-step hierarchical assignment method and compared it with the OAK.As a pre-processing step, our method separates the molecules in disjunctive molecular fragments like aromatic systems, rings and conjugated environments. The first assignment step maps these fragments of the molecules to corresponding fragments and guarantees a substructure preserving mapping at the atom level in the second assignment step. A special penalty function penalizes mappings between atoms from different substructures, which were not mapped in the first step. This function also adjusts the similarity score of mappings from atoms included in fragments to atoms, which were not part of a fragment. These modifications reduce the probability of topological errors and produce assignments with a reasonable mapping between molecular substructures.Virtual screening results of the OAK and the hierarchical assignment approach on several datasets from the directory of useful decoys (DUD) [3] showed that the hierarchical assignment achieved better BEDROC scores. [4] This performance gain is the result of the penalty of topological errors and ensures an improved distinction between biologically active and inactive compounds.