Example #1
0
        private void seleccionKruskal(Arista candidato, List <string> componentes, ListaArista arbolRM)
        {
            int    borrar = -1;
            string origen, destino;

            origen  = candidato.getOrigin().getCity().getName();
            destino = candidato.getDestination().getCity().getName();
            for (int i = 0; i < componentes.Count; i++)
            {
                if (componentes[i].Contains(origen))
                {
                    for (int j = 0; j < componentes.Count; j++)
                    {
                        if (componentes[j].Contains(destino))
                        {
                            if (i != j)
                            {
                                borrar          = j;
                                componentes[i] += componentes[j];
                                arbolRM.Add(candidato);
                            }
                        }
                    }
                }
            }
            if (borrar > -1)
            {
                componentes.RemoveAt(borrar);
            }
        }