3.22.4 AddConstraint

bool AddConstraint(const OEMatchPair<OEAtomBase> &mp)
bool AddConstraint(const OEMatchPair<OEBondBase> &mp)

The search space of a maximum common subgraph determination can be restricted by constraining pairs of nodes or edges (atoms or bonds) to be mapped onto one another in all subgraph solutions. Failure to satisfy atom or bond pairwise constraints will prevent any subgraph solutions from being identified. Constraints are considered satisfied in subgraphs which do not contain any constrained atoms or bonds in either the pattern or target molecules.

Both AddConstraint methods return true if a constraint is added successfully. If the pattern atom or bond in the OEMatchPair does not exist as part of the query molecule created in the initialization of the OESubSearch object then AddConstraint will return false. Multiple calls to AddConstraint using the same pattern atom or bond will cause previously stored constraints to be overwritten as constraints are mutually exclusive. It is impossible to satisfy multiple simultaneous constraints for a single pattern atom or bond, hence the exclusivity.