コード例 #1
0
        public static Quiver <int> GetOddFlowerQuiver(int numVerticesInCenterPolygon, int firstVertex = DefaultFirstVertex)
        {
            if (!OddFlowerParameterIsValid(numVerticesInCenterPolygon))
            {
                throw new ArgumentOutOfRangeException(nameof(numVerticesInCenterPolygon));
            }

            // Sort of backwards to construct the entire QP only to return just the quiver
            // But this reduces duplicated logic
            var qp = UsefulQPs.GetOddFlowerQP(numVerticesInCenterPolygon, firstVertex);

            return(qp.Quiver);
        }
        /// <remarks>It is <em>assumed</em> that <em>all</em> odd flower QPs are self-injective.</remarks>
        public SelfInjectiveQP <int> GetSelfInjectiveOddFlowerQP(int numVerticesInCenterPolygon, int firstVertex = DefaultFirstVertex)
        {
            if (numVerticesInCenterPolygon < 3 || numVerticesInCenterPolygon.Modulo(2) == 0)
            {
                throw new ArgumentOutOfRangeException(nameof(numVerticesInCenterPolygon));
            }

            var qp = UsefulQPs.GetOddFlowerQP(numVerticesInCenterPolygon);

            int numLayers = (numVerticesInCenterPolygon + 1) / 2;
            int numVerticesInFullInnerLayer = 2 * numVerticesInCenterPolygon;
            int numVerticesInOuterLayer     = 2 * numVerticesInFullInnerLayer;

            // Rotate clockwise by 2*pi / ((numVerticesInCenterPolygon-1)/2) for the Nakayama permutation?
            var nakayamaPermutation = new Dictionary <int, int>();

            for (int layerIndex = 0; layerIndex < numLayers; layerIndex++)
            {
                var layer = GetLayerVertices(layerIndex);
                for (int indexInLayer = 0; indexInLayer < layer.Count; indexInLayer++)
                {
                    int input           = layer[indexInLayer];
                    int stepsToRotateBy = (numVerticesInCenterPolygon - 1) / 2 * (layer.Count / numVerticesInCenterPolygon);
                    int output          = layer[indexInLayer + stepsToRotateBy];
                    nakayamaPermutation[input] = output;
                }
            }

            return(new SelfInjectiveQP <int>(qp, nakayamaPermutation));

            CircularList <int> GetLayerVertices(int layerIndex) // 0-based layer index
            {
                if (layerIndex == 0)
                {
                    return(new CircularList <int>(Enumerable.Range(1, numVerticesInCenterPolygon)));
                }
                int startVertex = layerIndex * numVerticesInFullInnerLayer - numVerticesInCenterPolygon + 1;
                int numVertices = layerIndex < numLayers - 1 ? numVerticesInFullInnerLayer : numVerticesInOuterLayer;

                return(new CircularList <int>(Enumerable.Range(startVertex, numVertices)));
            }
        }