Hello,

The term 'subgraph isomorphism' is (I think) usually used to mean
finding a subgraph of a graph G that is isomorphic to another graph H.
What you describe sounds like the more difficult problem of finding
all common subgraphs of G and H.

So, I am not so sure that the javadocs are unclear in this case. There
is the possibility that H may be found multiple times in G (a polymer,
for example, will have multiple copies of the monomer in it), which is
presumably why the return value of these methods are lists.

As for how this could be done - well the simplest (and most expensive)
way would be to enumerate every (connected?) subgraph of H, testing
each one to see if it is also a subgraph of G.

Gilleain Torrance

On Mon, Mar 8, 2010 at 11:10 AM, Leonid Chepelev
<[email protected]> wrote:
> Hello All,
>
> When trying to find all the subgraph isomorphisms, one would anticipate from
> the javadocs that the use of the
> UniversalIsomorphismTester.getSubgraphAtomsMaps of CDK 1.2.5 would
> return ALL the subgraph isomorphisms in a molecule of interest. However,
> that is not the case. I am posting the code below to provide an example of
> this behaviour: for the two molecules in question, we can see that there is
> only one MCS from the MCSS code (as one would expect), but also only two
> lists of RMaps from getSubgraphAtomsMaps, indicating only two subgraphs
> identified.
>
> Do you believe it would be possible to get ALL the subgraphs, no matter how
> small, into the getSubgraphAtomsMaps, as one would anticipate from the
> description, or is there another way to do this within (or outside CDK)?
>
> Am I doing things correctly?
>
> If the behaviour of getSubgraphAtomsMaps is intentionally such that it only
> returns n biggest subgraph matches, may I kindly suggest that the javadoc
> description be changed?
>
> Regards,
>
> Leonid Chepelev
>
> ***************************************************************
> import java.util.Iterator;
> import java.util.List;
> import org.openscience.cdk.io.SMILESWriter;
> import java.io.StringWriter;
> import org.openscience.cdk.DefaultChemObjectBuilder;
> import org.openscience.cdk.interfaces.IAtomContainer;
> import org.openscience.cdk.isomorphism.mcss.RMap;
> import org.openscience.cdk.Molecule;
> import org.openscience.cdk.smiles.SmilesParser;
> import org.openscience.cdk.isomorphism.UniversalIsomorphismTester;
> public class Main {
>     public static void main(String[] args) throws Exception {
>         SmilesParser smilesParser = new
> SmilesParser(DefaultChemObjectBuilder.getInstance());
>         String referenceMolecule = "C1CCCCC1CC(=O)OCCCC";
>         String testmolecule = "C1CCCCC1CC(=O)O";
>         IAtomContainer molecule =
> smilesParser.parseSmiles(referenceMolecule);
>         IAtomContainer lookup = smilesParser.parseSmiles(testmolecule);
>         List allthefragments =
> UniversalIsomorphismTester.getOverlaps(molecule, lookup);
>         for (Iterator<IAtomContainer> i = allthefragments.iterator();
> i.hasNext( ); ) {
>          IAtomContainer s = i.next( );
>          try {
>              StringWriter funna = new StringWriter();
>              SMILESWriter writemysmiles = new SMILESWriter();
>              writemysmiles.setWriter(funna);
>              Molecule themoleculetowrite = new Molecule(s);
>              writemysmiles.write(themoleculetowrite);
>              writemysmiles.close();
>              System.out.println(funna.toString());
>              funna.close();
>              } catch (Exception e) {
>                 System.out.println(e.toString());
>              }
>         }
>         List<List<RMap>> atommappingsad =
> UniversalIsomorphismTester.getSubgraphAtomsMaps(molecule, lookup);
>          for (List<RMap> j:atommappingsad) {
>             for (RMap estro:j){
>                 try {
>                      int firsta = estro.getId1();
>                      int seconda = estro.getId2();
>                      System.out.println("Atom " + firsta + " in G1 maps to
> atom " + seconda + " in G2.");
>                 } catch (Exception e) {
>                      System.out.println(e.toString());
>                 }
>             }
>          System.out.println("End of mapped fragment...");
>          }
>    }
> }
> ------------------------------------------------------------------------------
> Download Intel&#174; Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> Cdk-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/cdk-user
>
>

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Cdk-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cdk-user

Reply via email to