Пример #1
0
        public PartialViewResult GetRoute(int startIndex)
        {
            var routes = new List <Route>();

            try
            {
                var path = new int[Graph.GetLength(1)];
                var cost = new int[Graph.GetLength(1)];
                DijkstraSolution.FindShortestPath(Graph, startIndex, path, cost, Max);

                for (var i = 0; i < path.Length; i++)
                {
                    routes.Add(new Route
                    {
                        Index     = i,
                        PointName = "v" + i,
                        Cost      = cost[i],
                        Path      = GetPath(path, i, startIndex)
                    });
                }
            }
            catch (Exception ex)
            {
            }
            return(PartialView(routes));
        }