Пример #1
0
        public void TestTransversal()
        {
            int size = 4;
            // Sym(n) : make the total symmetry group
            PermutationGroup group = PermutationGroup.MakeSymN(size);

            // Aut(G) : make the automorphism group for a graph
            Permutation p1         = new Permutation(2, 1, 0, 3);
            Permutation p2         = new Permutation(0, 3, 2, 1);
            var         generators = new List <Permutation>
            {
                p1,
                p2
            };
            PermutationGroup subgroup = new PermutationGroup(size, generators);

            // generate the traversal
            var transversal = group.Transversal(subgroup);

            int subgroupOrder   = (int)subgroup.Order();
            int groupOrder      = (int)group.Order();
            int transversalSize = transversal.Count;

            // check that |Aut(G)| / |Sym(N)| = |Transversal|
            Assert.AreEqual(Factorial(size), groupOrder);
            Assert.AreEqual(groupOrder / subgroupOrder, transversalSize);
        }
Пример #2
0
        public void Test(IAtomContainer mol, int expected)
        {
            AtomDiscretePartitionRefiner refiner = new AtomDiscretePartitionRefiner();
            PermutationGroup             group   = refiner.GetAutomorphismGroup(mol);

            Assert.AreEqual(expected, group.Order());
        }
Пример #3
0
        public void OrderTest()
        {
            int size             = 5;
            PermutationGroup sym = PermutationGroup.MakeSymN(size);

            Assert.AreEqual(Factorial(size), sym.Order());
        }
Пример #4
0
        public void EnterTest()
        {
            int size = 4;
            PermutationGroup group = new PermutationGroup(size);

            group.Enter(new Permutation(1, 0, 3, 2));
            Assert.AreEqual(2, group.Order());
        }
Пример #5
0
        /// <summary>
        /// Generate a transversal of a subgroup in this group.
        /// </summary>
        /// <param name="subgroup">the subgroup to use for the transversal</param>
        /// <returns>a list of permutations</returns>
        public IReadOnlyCollection <Permutation> Transversal(PermutationGroup subgroup)
        {
            long m       = this.Order() / subgroup.Order();
            var  results = new List <Permutation>();
            var  transversalBacktracker = new TransversalBacktracker(this, subgroup, m, results);

            this.Apply(transversalBacktracker);
            return(results);
        }
        public void GetAutomorphismGroup_StartingPartitionTest()
        {
            Partition      partition             = Partition.FromString("0,1|2,3");
            string         acpString             = "C0C1C2C3 0:1(1),0:3(1),1:2(1),2:3(1)";
            IAtomContainer ac                    = AtomContainerPrinter.FromString(acpString, builder);
            AtomDiscretePartitionRefiner refiner = new AtomDiscretePartitionRefiner();
            PermutationGroup             autG    = refiner.GetAutomorphismGroup(ac, partition);

            Assert.AreEqual(2, autG.Order());
        }
        public void GetAutomorphismGroupTest()
        {
            string         acpString             = "C0C1C2O3 0:1(2),0:2(1),1:3(1),2:3(1)";
            IAtomContainer ac                    = AtomContainerPrinter.FromString(acpString, builder);
            AtomDiscretePartitionRefiner refiner = new AtomDiscretePartitionRefiner();
            PermutationGroup             autG    = refiner.GetAutomorphismGroup(ac);

            Assert.IsNotNull(autG);
            Assert.AreEqual(1, autG.Order());
        }
        public void RefineTest()
        {
            string         acpString             = "C0C1O2O3 0:1(1),0:3(1),1:2(1),2:3(1)";
            IAtomContainer ac                    = AtomContainerPrinter.FromString(acpString, builder);
            AtomDiscretePartitionRefiner refiner = new AtomDiscretePartitionRefiner();

            refiner.Refine(ac);
            PermutationGroup autG = refiner.GetAutomorphismGroup();

            Assert.AreEqual(2, autG.Order());
        }
        public void GetAutomorphismGroup_StartingGroupTest()
        {
            string                       acpString = "C0C1C2C3 0:1(1),0:2(1),1:3(1),2:3(1)";
            IAtomContainer               ac        = AtomContainerPrinter.FromString(acpString, builder);
            Permutation                  flip      = new Permutation(1, 0, 3, 2);
            PermutationGroup             autG      = new PermutationGroup(4, new[] { flip });
            AtomDiscretePartitionRefiner refiner   = new AtomDiscretePartitionRefiner();

            refiner.GetAutomorphismGroup(ac, autG);
            Assert.IsNotNull(autG);
            Assert.AreEqual(8, autG.Order());
        }
Пример #10
0
        public void Refine_IgnoreBondOrderTest()
        {
            string         acpString             = "C0C1C2C3 0:1(2),0:3(1),1:2(1),2:3(2)";
            IAtomContainer ac                    = AtomContainerPrinter.FromString(acpString, builder);
            bool           ignoreBondOrder       = true;
            BondDiscretePartitionRefiner refiner = new BondDiscretePartitionRefiner(ignoreBondOrder);

            refiner.Refine(ac);
            PermutationGroup autG = refiner.GetAutomorphismGroup();

            Assert.AreEqual(8, autG.Order());
        }
Пример #11
0
        public void GeneratorConstructor()
        {
            int         size       = 4;
            Permutation p1         = new Permutation(1, 0, 2, 3);
            Permutation p2         = new Permutation(1, 2, 3, 0);
            var         generators = new List <Permutation>
            {
                p1,
                p2
            };
            PermutationGroup group = new PermutationGroup(size, generators);

            Assert.AreEqual(size, group.Count);
            Assert.AreEqual(Factorial(size), group.Order());
        }