/// <summary>
        /// Retrieve list of nodes from database
        /// </summary>
        /// <returns>List of nodes</returns>
        public List <Node> GetNodes()
        {
            var databaseAccessLayer = new DatabaseAccessLayer();
            var nodes = databaseAccessLayer.GetNodes();

            return(nodes);
        }
Exemple #2
0
        /// <summary>
        /// Find Shortest path in graph, inside of databse. Currently use modified BFS alg.
        /// </summary>
        /// <param name="firstNodeId">Start node to search from</param>
        /// <param name="secondNodeId">Final node of path</param>
        public List <Node> FindShortestPath(int firstNodeId, int secondNodeId)
        {
            var         databaseAccessLayer = new DatabaseAccessLayer();
            List <Node> nodesUniList        = databaseAccessLayer.GetNodes();
            List <Node> nodesBiList         = databaseAccessLayer.GetNodesBidirectional(nodesUniList);
            var         breathSearchFirst   = new BreathSearchFirst();
            List <Node> resultNodes         = breathSearchFirst.FindShortestPath(nodesBiList, firstNodeId, secondNodeId);

            return(resultNodes);
        }