void expandNode(Node node) { // System.out.println(node.toString(target)); QuerySequenceElement el = sequence.get(node.sequenceElNum); if (el.center == null) // This node describers a bond that closes a ring { // Checking whether this bond is present in the target IAtom tAt0 = node.atoms[query.getAtomNumber(el.atoms[0])]; IAtom tAt1 = node.atoms[query.getAtomNumber(el.atoms[1])]; IBond tBo = target.getBond(tAt0, tAt1); if (tBo != null) if (el.bonds[0].matches(tBo)) { node.sequenceElNum++; // stack.push(node); if (node.sequenceElNum == sequence.size()) { // The node is not added in the stack if the end of the sequence is reached isomorphismFound = true; if (FlagStoreIsomorphismNode) isomorphismNodes.add(node); } else stack.push(node); } } else { targetAt.clear(); IAtom tAt = node.atoms[el.centerNum]; List<IAtom> conAt = target.getConnectedAtomsList(tAt); for (int i = 0; i < conAt.size(); i++) { if (!containsAtom(node.atoms, conAt.get(i))) targetAt.add(conAt.get(i)); } if (el.atoms.length <= targetAt.size()) generateNodes(node); } }
public List<IBond> generateBondMapping(IAtomContainer container, List<IAtom> atomMapping) { if (query == null) return null; List<IBond> v = new ArrayList<IBond>(); for (int i = 0; i < query.getBondCount(); i++) { IAtom qa0 = query.getBond(i).getAtom(0); IAtom qa1 = query.getBond(i).getAtom(1); IAtom a0 = atomMapping.get(query.getAtomNumber(qa0)); IAtom a1 = atomMapping.get(query.getAtomNumber(qa1)); v.add(container.getBond(a0, a1)); } return (v); }