コード例 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="startname"></param>
        /// <param name="finishName"></param>
        /// <returns></returns>
        public string FindShortestPath(string startname, string finishName)
        {
            var foundStart = graph.FindVertex(startname);
            var foundEnd   = graph.FindVertex(finishName);

            if (foundStart == null || foundEnd == null)
            {
                NotFoundEdgeExeption exeption = new NotFoundEdgeExeption();

                if (foundStart == null)
                {
                    exeption.NotFoundFirstEdge = startname;
                }

                if (foundEnd == null)
                {
                    exeption.NotFoundSecondEdge = finishName;
                }

                throw exeption;
            }

            return(FindShortestPath(graph.FindVertex(startname), graph.FindVertex(finishName)));
        }