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."); }
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)); }
internal static Route CreateStart(RouteNode startNode) { return(new Route(startNode, null, 0)); }
private Route(RouteNode endNode, Route startRoute, int distance) { StartRoute = startRoute; End = endNode; Distance = distance; }