Exemple #1
0
        public static Quiver <int> GetCobwebQuiver(int numVerticesInCenterPolygon, int firstVertex = DefaultFirstVertex)
        {
            if (!CobwebParameterIsValid(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.GetCobwebQP(numVerticesInCenterPolygon, firstVertex);

            return(qp.Quiver);
        }
        public SelfInjectiveQP <int> GetSelfInjectiveCobwebQP(int numVerticesInCenterPolygon, int firstVertex = DefaultFirstVertex)
        {
            if (numVerticesInCenterPolygon < 3 || numVerticesInCenterPolygon.Modulo(2) == 0)
            {
                throw new ArgumentOutOfRangeException(nameof(numVerticesInCenterPolygon));
            }

            var qp = UsefulQPs.GetCobwebQP(numVerticesInCenterPolygon);

            int numLayers = (numVerticesInCenterPolygon - 1) / 2;
            int numVerticesInFullLayer = 2 * numVerticesInCenterPolygon;

            // 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 = layerIndex == 0 ? (numVerticesInCenterPolygon - 1) / 2 : numVerticesInCenterPolygon - 1;
                    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 * numVerticesInFullLayer - numVerticesInCenterPolygon + 1;

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