// Ta metoda wymaga, aby wcześniej wyliczona była nowa macierz incydencji oraz lista wierzchołków grafu
        public void GenerateTriangulationOfGraph()
        {
            _parameters.TriangulationOfGraph = new Graph(true);//nowy graf

            MatrixMethod matrixMethod = new MatrixMethod(_parameters);

            _parameters.verticesTriangulationOfGraph = new List <Vertex>();//lista przechowująca wierzchołki

            var minimumFitnessGraphIndex = _parameters.FitnessArray.ToList().IndexOf(_parameters.FitnessArray.Min());
            var graphFromCaran           = GenerateGraphFromCaranWithCuts(
                _parameters.GeneratedBasicGraph,
                _parameters.Population,
                minimumFitnessGraphIndex
                );
            var groupsVertices = GraphGenerationMethods.GetGroupsVertices(
                graphFromCaran,
                _parameters.Population,
                minimumFitnessGraphIndex);

            VertexMethod.AddVertexGroupInfo(
                graphFromCaran,
                groupsVertices
                );

            _parameters.TriangulationOfGraph         = graphFromCaran;
            _parameters.verticesTriangulationOfGraph = graphFromCaran.Vertices.ToList();
        }
コード例 #2
0
        public static List <double> GetCutsCount(Graph basicGraph, double[][] caranArray)
        {
            var result = new List <double>();

            for (int i = 0; i < caranArray[0].Length; i++)
            {
                var groupsVertices = GraphGenerationMethods
                                     .GetGroupsVertices(basicGraph, caranArray, i)
                                     //.Where(x => x.Value != 0)
                                     .ToDictionary(x => x.Key, x => x.Value);
                var cuts = basicGraph.Edges.Where(x => groupsVertices[x.Target] != groupsVertices[x.Source]);
                result.Add(cuts.Count());
            }

            return(result);
        }