Example #1
0
        //function to count edges
        public int[] EdgeCounts()
        {
            var population = parameters.Population;
            var result = new int[population[0].Length];

            for (int i = 0; i < population[0].Length; i++)
            {
                //var edgeCount = 0;
                var groupGraphs = GraphGenerationMethods.GenerateGraphFromCaran(population, i).
                    Where(x => x != null).
                    Where(x => x.VertexCount != 0);
                groupGraphs.ToList().ForEach(x => EdgeMethod.ConnectAllVertices(x));
                var edgeCount = groupGraphs.Select(x => x.EdgeCount).Sum();

                result[i] = edgeCount;
            }

            return result;
        }