Exemple #1
0
 public bool Contains(RouteNode node)
 {
     if (End == node)
     {
         return(true);
     }
     return(StartRoute != null && StartRoute.Contains(node));
 }
        private RouteEdge GetEdge(RouteNode startNode, RouteNode endNode)
        {
            foreach (var edge in _edges[startNode])
            {
                if (edge.End == endNode)
                {
                    return(edge);
                }
            }

            throw new InvalidOperationException($"Route from {startNode} to {endNode} is not available.");
        }
Exemple #3
0
 public RouteEdge(RouteNode start, RouteNode end, int distance)
 {
     this.Start    = start;
     this.End      = end;
     this.Distance = distance;
 }
 public IEnumerable <Route> Walk(RouteNode startNode, Func <Route, bool> routeVisitor)
 {
     return(Walk(Route.CreateStart(startNode), routeVisitor));
 }
Exemple #5
0
 internal static Route CreateStart(RouteNode startNode)
 {
     return(new Route(startNode, null, 0));
 }
Exemple #6
0
 private Route(RouteNode endNode, Route startRoute, int distance)
 {
     StartRoute = startRoute;
     End        = endNode;
     Distance   = distance;
 }