Exemplo n.º 1
0
        ElementoDijkstra sigDefinitivo(List <ElementoDijkstra> VD)
        {
            ElementoDijkstra ed = new ElementoDijkstra(new Nodo(' '), 10000, false);

            foreach (ElementoDijkstra e in VD)
            {
                if (e.GetDef() == false && e.getPeso() < ed.getPeso())
                {
                    ed = e;
                }
            }
            ed.setDef(true);

            if (ed.getPeso() != 10000)
            {
                return(ed);
            }
            return(null);
        }
Exemplo n.º 2
0
        public String Ruta(ElementoDijkstra ed, List <ElementoDijkstra> VD)
        {
            String r = "";

            if (ed.GetProv() != null)
            {
                r = ed.GetDes().getCiudad().ToString();
                foreach (ElementoDijkstra aux in VD)
                {
                    if (aux.GetDes() == ed.GetProv())
                    {
                        r = Ruta(aux, VD) + "->" + r;
                        break;
                    }
                }
            }
            else
            {
                r = ed.GetDes().getCiudad().ToString();
            }
            return(r);
        }