Beispiel #1
0
        /// <summary>
        /// Find the shortest path between the two given currencies.
        /// </summary>
        public Path Solve(Currency from, Currency to)
        {
            shortestPath = new Path(from, to);
            var fromNode = graph.FindNode(from);
            var toNode   = graph.FindNode(to);

            if (fromNode != null && toNode != null)
            {
                Init(fromNode);
                Explore(toNode);
                ConstructPath(fromNode, toNode);
            }

            return(shortestPath);
        }