Exemplo n.º 1
0
        public Graph()
        {
            var main = new MainCtr();

            _airportCtr = main.AirportCtr;
            _vertices   = new List <Vertex>();
        }
Exemplo n.º 2
0
        private static IEnumerable <Vertex> RunDijkstra(Airport from, Airport to, string date, bool usePrice)
        {
            var        main       = new MainCtr();
            AirportCtr airportCtr = main.AirportCtr;
            Dijkstra   dijkstra   = new Dijkstra();

            var result = dijkstra.RunDijkstra(from, to, date, usePrice);

            return(result);
        }
Exemplo n.º 3
0
        private static void PrintInfo(IEnumerable <Vertex> shortestpath)
        {
            var        main       = new MainCtr();
            AirportCtr airportCtr = main.AirportCtr;
            double     time       = 0;
            double     price      = 0;

            Console.WriteLine("Travel route:");
            foreach (var v in shortestpath)
            {
                Console.WriteLine(v.EdgeToUse.VertexEdge.flightID + " from: " +
                                  airportCtr.GetAirportByID(v.EdgeToUse.VertexEdge.@from).name + " to: " +
                                  airportCtr.GetAirportByID(v.EdgeToUse.VertexEdge.to).name
                                  + " Price: " + v.EdgeToUse.VertexEdge.price + "kr. Traveltime: " +
                                  v.EdgeToUse.VertexEdge.traveltime);
                time  += (double)v.EdgeToUse.VertexEdge.traveltime;
                price += (double)v.EdgeToUse.VertexEdge.price;
            }
            Console.WriteLine("Totals - Price: {0}, Traveltime: {1}", price, time);
        }