public static void ClusterSelection(double k, Graph G , int n)
 {
     for (int i = 0; i < G.V.Count; i++)
     {
         for (int j = i + 1; j < G.V.Count; j++)
         {
             G.E.Add(new Edge(G.V[i], G.V[j]));
         }
     }
         G.FindMinSpanTree(G.V[0]);
     for (int i = 0; i < G.E.Count; i++)
     {
         if (!G.E[i].optimal)
         {
             G.E.Remove(G.E[i]);
             i--;
         }
     }
     for (int i = 0; i < G.E.Count(); i++)
     {
         Form1.el += Convert.ToString(Math.Round(G.E[i].Weight, 2));
         Form1.el += "; ";
     }
     Form1.al = Convert.ToString(AverageEdgeWeight(1, G));
     LongestEdge(G);
     r =  RelCount(G);
     if (n == 1)
     {
         while (lEdgeWeight > k * slEdgeWeight)
         {
             G.E.Remove(G.E[longestEdgeindex]);
             LongestEdge(G);
         }
     }
     else
     {
         if (n == 2)
         {
             while (lEdgeWeight > k * AverageEdgeWeight(1, G))
             {
                 G.E.Remove(G.E[longestEdgeindex]);
                 LongestEdge(G);
             }
         }
         else
         {
             if (n == 3)
             {
                 double temp = AverageEdgeWeight(1, G);
                 while (lEdgeWeight > k * temp)
                 {
                     G.E.Remove(G.E[longestEdgeindex]);
                     LongestEdge(G);
                 }
             }
             else
             {
                 while (lEdgeWeight > k * AverageEdgeWeight(2, G))
                 {
                     G.E.Remove(G.E[longestEdgeindex]);
                     LongestEdge(G);
                 }
             }
         }
     }
 }