예제 #1
0
 /// <summary>  Constructor for the RNode object
 ///
 /// </summary>
 /// <param name="id1"> number of the bond in the graphe 1
 /// </param>
 /// <param name="id2"> number of the bond in the graphe 2
 /// </param>
 public RNode(int id1, int id2)
 {
     rMap      = new RMap(id1, id2);
     extension = new System.Collections.BitArray(64);
     forbidden = new System.Collections.BitArray(64);
 }
예제 #2
0
 /// <summary>  Constructor for the RNode object
 /// 
 /// </summary>
 /// <param name="id1"> number of the bond in the graphe 1
 /// </param>
 /// <param name="id2"> number of the bond in the graphe 2
 /// </param>
 public RNode(int id1, int id2)
 {
     rMap = new RMap(id1, id2);
     extension = new System.Collections.BitArray(64);
     forbidden = new System.Collections.BitArray(64);
 }
 /// <summary>  This makes a map of matching atoms out of a map of matching bonds as produced by the get(Subgraph|Ismorphism)Map methods.
 /// 
 /// </summary>
 /// <param name="l">  The list produced by the getMap method.
 /// </param>
 /// <param name="g1"> The first atom container.
 /// </param>
 /// <param name="g2"> The second one (first and second as in getMap)
 /// </param>
 /// <returns>     The mapping found projected on g1. This is a List of RMap objects containing Ids of matching atoms.
 /// </returns>
 public static System.Collections.IList makeAtomsMapOfBondsMap(System.Collections.IList l, IAtomContainer g1, IAtomContainer g2)
 {
     if (l == null)
         return (l);
     IBond[] bonds1 = g1.Bonds;
     IBond[] bonds2 = g2.Bonds;
     System.Collections.IList result = System.Collections.ArrayList.Synchronized(new System.Collections.ArrayList(10));
     for (int i = 0; i < l.Count; i++)
     {
         IBond bond1 = bonds1[((RMap)l[i]).Id1];
         IBond bond2 = bonds2[((RMap)l[i]).Id2];
         IAtom[] atom1 = bond1.getAtoms();
         IAtom[] atom2 = bond2.getAtoms();
         for (int j = 0; j < 2; j++)
         {
             IBond[] bondsConnectedToAtom1j = g1.getConnectedBonds(atom1[j]);
             for (int k = 0; k < bondsConnectedToAtom1j.Length; k++)
             {
                 if (bondsConnectedToAtom1j[k] != bond1)
                 {
                     IBond testBond = bondsConnectedToAtom1j[k];
                     for (int m = 0; m < l.Count; m++)
                     {
                         IBond testBond2;
                         if (((RMap)l[m]).Id1 == g1.getBondNumber(testBond))
                         {
                             testBond2 = bonds2[((RMap)l[m]).Id2];
                             for (int n = 0; n < 2; n++)
                             {
                                 System.Collections.IList bondsToTest = g2.getConnectedBondsVector(atom2[n]);
                                 if (bondsToTest.Contains(testBond2))
                                 {
                                     RMap map;
                                     if (j == n)
                                     {
                                         map = new RMap(g1.getAtomNumber(atom1[0]), g2.getAtomNumber(atom2[0]));
                                     }
                                     else
                                     {
                                         map = new RMap(g1.getAtomNumber(atom1[1]), g2.getAtomNumber(atom2[0]));
                                     }
                                     if (!result.Contains(map))
                                     {
                                         result.Add(map);
                                     }
                                     RMap map2;
                                     if (j == n)
                                     {
                                         map2 = new RMap(g1.getAtomNumber(atom1[1]), g2.getAtomNumber(atom2[1]));
                                     }
                                     else
                                     {
                                         map2 = new RMap(g1.getAtomNumber(atom1[0]), g2.getAtomNumber(atom2[1]));
                                     }
                                     if (!result.Contains(map2))
                                     {
                                         result.Add(map2);
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     return (result);
 }