Ejemplo n.º 1
0
        public void AllOf()
        {
            IntSet one = IntSet.AllOf(4, 2);

            Assert.IsFalse(one.Contains(0));
            Assert.IsFalse(one.Contains(1));
            Assert.IsTrue(one.Contains(2));
            Assert.IsFalse(one.Contains(3));
            Assert.IsTrue(one.Contains(4));
            Assert.IsFalse(one.Contains(5));
        }
Ejemplo n.º 2
0
        public void Furan()
        {
            Graph    g = Graph.FromSmiles("o1cccc1");
            IntSet   s = IntSet.AllOf(1, 2, 3, 4); // exclude the oxygen
            Matching m = Matching.CreateEmpty(g);

            MaximumMatching.Maximise(g, m, 0, s);
            Assert.IsTrue(Compares.AreOrderLessDeepEqual(
                              new[] { Tuple.Of(1, 2), Tuple.Of(3, 4) },
                              m.GetMatches()));
        }
Ejemplo n.º 3
0
        [TestMethod()] public void Simple_augment_subset()
        {
            Graph    g = Graph.FromSmiles("cccc");
            Matching m = Matching.CreateEmpty(g);

            m.Match(1, 2);
            // no vertex '3' matching can not be improved
            MaximumMatching.Maximise(g, m, 2, IntSet.AllOf(0, 1, 2));
            Assert.IsTrue(Compares.AreOrderLessDeepEqual(
                              new[] { Tuple.Of(1, 2) },
                              m.GetMatches()));
        }
Ejemplo n.º 4
0
        [TestMethod()] public void Imidazole()
        {
            Graph    g = Graph.FromSmiles("[nH]1ccnc1");
            Matching m = Matching.CreateEmpty(g);

            MaximumMatching.Maximise(g,
                                     m,
                                     0,
                                     IntSet.AllOf(1, 2, 3, 4)); // not the 'nH'
            Assert.IsTrue(Compares.AreOrderLessDeepEqual(
                              new[] { Tuple.Of(1, 2), Tuple.Of(3, 4) },
                              m.GetMatches()));
        }
Ejemplo n.º 5
0
        public void Quinone_subset()
        {
            Graph g = Graph.FromSmiles("Oc1ccc(o)cc1");
            // mocks the case where the oxygen atoms are already double bonded - we
            // therefore don't include those of the adjacent carbons in the vertex
            // subset to be matched
            Matching m = Matching.CreateEmpty(g);

            MaximumMatching.Maximise(g, m, 0, IntSet.AllOf(2, 3, 6, 7));
            Assert.IsTrue(Compares.AreOrderLessDeepEqual(
                              new[] {
                Tuple.Of(2, 3),
                Tuple.Of(6, 7),
            },
                              m.GetMatches()));
        }