public void SearchBasedHeuristic(object sender, EventArgs e)
        {
            String locFileName = (String)Session["locationFileName"];

            _locationsInfo = _locNodes.getLocationsInfo(_absolutePath + locFileName);
            List <LocationInfo> _graphicalNodes = _locationsInfo;

            _graphicalNodes = _locNodes.getLocationsInfo(_absolutePath + locFileName);

            foreach (RadComboBoxItem excludeNodes in excludeLocationsNodes.Items)
            {
                if (!(excludeNodes.Checked == false))
                {
                    _graphicalNodes = _graphicalNodes.Where(query => query._node._node != excludeNodes.Text).ToList();
                }
            }

            double totalCostOfTraversal = 0.0;

            //convert start and end to location obj
            _startNode = _graphicalNodes.FirstOrDefault(query => query._node._node == startLocationsList.SelectedItem.Text);
            _endNode   = _graphicalNodes.FirstOrDefault(query => query._node._node == endLocationsList.SelectedItem.Text);

            String connFileName = (String)Session["connectionFileName"];

            _connectionsInfo = _connEdges.getConnectionsInfo(_absolutePath + connFileName, _graphicalNodes);

            string locationsNodes   = (string)Session["locationNodes"];
            string connectionsEdges = (string)Session["connectionEdges"];

            //Branch to either shortest distance heuristic based on the search heuristic dropdown
            if (selectHeuristicCombo.SelectedItem.Value == shortestDistance)
            {
                ShortestDistanceSearchAlgorithm aStarSearch    = new ShortestDistanceSearchAlgorithm(_startNode, _endNode, _locationsInfo, _connectionsInfo);
                List <LocationInfo>             resultantArray = aStarSearch.AStarTraversal();
                String nodesAndCost = "";

                foreach (LocationInfo locationInfo in resultantArray)
                {
                    totalCostOfTraversal += locationInfo._costOfTraversal._g;
                    nodesAndCost         += ("<br>Node:" + locationInfo._node._node + "| Interim Traversal Cost:" + locationInfo._costOfTraversal._g + "| Cumulative Traversal Cost:" + totalCostOfTraversal);
                }

                String finalOutputNodes = "";
                foreach (LocationInfo locationInfo in resultantArray)
                {
                    finalOutputNodes += locationInfo._node._node + ',';
                    nodesAndCost     += ("-" + locationInfo._node._node);
                }
                finalOutputNodes = finalOutputNodes.TrimEnd(',');
                nodesAndCost    += ("<br>Total Cost of Travel: " + resultantArray[resultantArray.Count - 1]._costOfTraversal._g);
                nodesAndCost     = nodesAndCost.TrimStart('-');
                path.Text        = nodesAndCost;

                //Send the output, the locations and connections info so that vis populates the connected graph
                ScriptManager.RegisterStartupScript(this, typeof(Page), "GraphParameters", String.Format("populateNodesAndEdges('{0}','{1}','{2}');", finalOutputNodes, locationsNodes, connectionsEdges), true);
            }
            //Branch to the fewest links heuristic based on the search heuristic dropdown
            else if (selectHeuristicCombo.SelectedItem.Value == fewestLinks)
            {
                FewerLinksSearchAlgorithm aStarSearch = new FewerLinksSearchAlgorithm(_startNode, _endNode, _locationsInfo, _connectionsInfo);
                String aStarOutput        = "";
                String finalOutputNodes   = "";
                String resultWithMinLinks = aStarSearch.searchByLinks();
                resultWithMinLinks = resultWithMinLinks.TrimStart(',');
                resultWithMinLinks = resultWithMinLinks.TrimEnd(',');
                finalOutputNodes   = resultWithMinLinks.TrimEnd(',');
                int resultWithLinks = resultWithMinLinks.Count(query => query == ',');
                aStarOutput += ("<br>Path Final:" + resultWithMinLinks);
                aStarOutput += ("<br>Links travelled:" + resultWithLinks);
                path.Text    = aStarOutput;

                //Send the output, the locations and connections info so that vis populates the connected graph
                ScriptManager.RegisterStartupScript(this, typeof(Page), "GraphParameters", String.Format("populateNodesAndEdges('{0}','{1}','{2}');", finalOutputNodes, locationsNodes, connectionsEdges), true);
            }
        }
        public void SearchBasedHeuristic(object sender, EventArgs e)
        {
            String locFileName = (String)Session["locationFileName"];
            _locationsInfo = _locNodes.getLocationsInfo(_absolutePath + locFileName);
            List<LocationInfo> _graphicalNodes = _locationsInfo;
            _graphicalNodes = _locNodes.getLocationsInfo(_absolutePath + locFileName);

            foreach (RadComboBoxItem excludeNodes in excludeLocationsNodes.Items)
            {
                if (!(excludeNodes.Checked == false))
                    _graphicalNodes = _graphicalNodes.Where(query => query._node._node != excludeNodes.Text).ToList();
            }

            double totalCostOfTraversal = 0.0;
            //convert start and end to location obj
            _startNode = _graphicalNodes.FirstOrDefault(query => query._node._node == startLocationsList.SelectedItem.Text);
            _endNode = _graphicalNodes.FirstOrDefault(query => query._node._node == endLocationsList.SelectedItem.Text);

            String connFileName = (String)Session["connectionFileName"];
            _connectionsInfo = _connEdges.getConnectionsInfo(_absolutePath + connFileName, _graphicalNodes);

            string locationsNodes = (string)Session["locationNodes"];
            string connectionsEdges = (string)Session["connectionEdges"];

            //Branch to either shortest distance heuristic based on the search heuristic dropdown
            if (selectHeuristicCombo.SelectedItem.Value == shortestDistance) {
                ShortestDistanceSearchAlgorithm aStarSearch = new ShortestDistanceSearchAlgorithm(_startNode, _endNode, _locationsInfo, _connectionsInfo);
                List<LocationInfo> resultantArray = aStarSearch.AStarTraversal();
                String nodesAndCost = "";

                foreach (LocationInfo locationInfo in resultantArray)
                {
                    totalCostOfTraversal += locationInfo._costOfTraversal._g;
                    nodesAndCost += ("<br>Node:" + locationInfo._node._node + "| Interim Traversal Cost:" + locationInfo._costOfTraversal._g + "| Cumulative Traversal Cost:" + totalCostOfTraversal);
                }

                String finalOutputNodes = "";
                foreach (LocationInfo locationInfo in resultantArray)
                {
                    finalOutputNodes += locationInfo._node._node + ',';
                    nodesAndCost += ("-" + locationInfo._node._node);
                }
                finalOutputNodes=finalOutputNodes.TrimEnd(',');
                nodesAndCost += ("<br>Total Cost of Travel: " + resultantArray[resultantArray.Count - 1]._costOfTraversal._g);
                nodesAndCost = nodesAndCost.TrimStart('-');
                path.Text = nodesAndCost;

                //Send the output, the locations and connections info so that vis populates the connected graph
                ScriptManager.RegisterStartupScript(this, typeof(Page), "GraphParameters", String.Format("populateNodesAndEdges('{0}','{1}','{2}');", finalOutputNodes, locationsNodes, connectionsEdges), true);
            }
            //Branch to the fewest links heuristic based on the search heuristic dropdown
            else if (selectHeuristicCombo.SelectedItem.Value == fewestLinks)
            {
                FewerLinksSearchAlgorithm aStarSearch = new FewerLinksSearchAlgorithm(_startNode, _endNode, _locationsInfo, _connectionsInfo);
                String aStarOutput = "";
                String finalOutputNodes = "";
                String resultWithMinLinks = aStarSearch.searchByLinks();
                resultWithMinLinks = resultWithMinLinks.TrimStart(',');
                resultWithMinLinks = resultWithMinLinks.TrimEnd(',');
                finalOutputNodes = resultWithMinLinks.TrimEnd(',');
                int resultWithLinks = resultWithMinLinks.Count(query => query == ',');
                aStarOutput += ("<br>Path Final:" + resultWithMinLinks);
                aStarOutput += ("<br>Links travelled:" + resultWithLinks);
                path.Text = aStarOutput;

                //Send the output, the locations and connections info so that vis populates the connected graph
                ScriptManager.RegisterStartupScript(this, typeof(Page), "GraphParameters", String.Format("populateNodesAndEdges('{0}','{1}','{2}');", finalOutputNodes, locationsNodes, connectionsEdges), true);
            }
        }