コード例 #1
0
        /// <summary>
        /// Find all paths in road graph from start node to finish node
        /// </summary>
        /// <returns>Found paths</returns>
        public List <RoadPath> FindAllPaths()
        {
            CheckMapErrors(roadMap);

            startNode  = roadMap.Nodes.Where(n => n.Role == RoadNodeRole.Start).Single();
            finishNode = roadMap.Nodes.Where(n => n.Role == RoadNodeRole.Finish).Single();
            visitedNodes.Add(startNode);
            currentPath.Push(startNode);
            FindPaths(startNode);

            return(pathsFound);
        }
コード例 #2
0
        public object Clone()
        {
            RoadPath clone = new RoadPath();

            foreach (RoadNode node in this.ToList())
            {
                clone.Push(node);
            }
            return(clone);
        }