public GraphEnumerator(Graph <T> graph, GraphSearchAlgorithm graphSearchAlgorithm) { Graph = graph; GraphSearchAlgorithm = graphSearchAlgorithm; LoadIteratorCache(); }
public void BeginSearch(string algorythm, Node start, Node goal, int framesPerSecond, int beamPaths) { if (algorythm != null) { switch (algorythm) { case ("BFS"): searchAlgorithm = new BFS(); break; case ("DFS"): searchAlgorithm = new DFS(); break; case ("Hill Climbing"): searchAlgorithm = new HillClimbing(); break; case ("Beam"): searchAlgorithm = new Beam(beamPaths); break; case ("Branch and Bound"): searchAlgorithm = new BranchAndBound(); break; case ("A*"): searchAlgorithm = new AStar(); break; default: searchAlgorithm = null; break; } if (searchAlgorithm != null) { ResetAllPaths(); Debug.LogFormat("Building a path using {0}.", algorythm); searchCoroutine = StartCoroutine(searchAlgorithm.Search(GraphGenerator.Nodes, GraphGenerator.Size, start, goal, framesPerSecond)); } else { Debug.LogWarning("Invalid algorythm. Search canceled."); } } else { Debug.LogWarning("Algorythm not set. Search canceled."); } }
public GraphEnumerator(TFollow root, GraphSearchAlgorithm graphSearchAlgorithm, Func <TFollow, IEnumerable <TFollow> > childrenProjector) { Root = root; GraphSearchAlgorithm = graphSearchAlgorithm; ChildrenProjector = childrenProjector; _visited = new HashSet <TFollow>(); switch (GraphSearchAlgorithm) { case GraphSearchAlgorithm.BreadthFirstSearch: _remaining = new FirstInFirstOutCollection <TFollow>(); break; case GraphSearchAlgorithm.DepthFirstSearch: _remaining = new LastInFirstOutCollection <TFollow>(); break; default: throw new ArgumentException("Unknown graph search algorithm", "graphSearchAlgorithm"); } _remaining.Add(Root); }
public GraphEnumerable(TFollow root, GraphSearchAlgorithm graphSearchAlgorithm, Func <TFollow, IEnumerable <TFollow> > childrenProjector) { Root = root; GraphSearchAlgorithm = graphSearchAlgorithm; ChildrenProjector = childrenProjector; }
public GraphEnumerable(TFollow root, GraphSearchAlgorithm graphSearchAlgorithm) : this(root, graphSearchAlgorithm, (item => CommonUtility.AllPropertyChildren <TFollow>(item))) { }
public GraphEnumerable(Graph <T> graph, GraphSearchAlgorithm graphSearchAlgorithm) { Graph = graph; GraphSearchAlgorithm = graphSearchAlgorithm; }
public void SetAlgorythm(GraphSearchAlgorithm algorythm) { searchAlgorithm = algorythm; }