About 456,000 results
Open links in new tab
  1. Why DFS and not BFS for finding cycle in graphs

    May 29, 2020 · Predominantly DFS is used to find a cycle in graphs and not BFS. Any reasons? Both can find if a node has already been visited while traversing the tree/graph.

  2. algorithm - Using BFS for Weighted Graphs - Stack Overflow

    May 23, 2015 · A BFS will consider all edges from a single node before moving on to other nodes, while Dijkstra's algorithm will always consider the lowest-weight unseen edge, from the set of …

  3. bfs与dfs的优缺点? - 知乎

    BFS则比较适合判断二分图,以及用于实现寻找最小生成树(MST),如在BFS基础上的Kruskal算法。 还有寻找最短路径问题(如Dijkstra算法)。

  4. How to trace the path in a Breadth-First Search? - Stack Overflow

    Jan 19, 2012 · How do you trace the path of a Breadth-First Search, such that in the following example: If searching for key 11, return the shortest list connecting 1 to 11. [1, 4, 7, 11]

  5. How does a Breadth-First Search work when looking for Shortest …

    Technically, Breadth-first search (BFS) by itself does not let you find the shortest path, simply because BFS is not looking for a shortest path: BFS describes a strategy for searching a …

  6. Why use Dijkstra's Algorithm if Breadth First Search (BFS) can do …

    Oct 6, 2018 · Dijkstra allows assigning distances other than 1 for each step. For example, in routing the distances (or weights) could be assigned by speed, cost, preference, etc. The …

  7. graph - What is difference between BFS and Dijkstra's algorithms …

    May 3, 2017 · The rules for BFS for finding shortest-path in a graph are: We discover all the connected vertices, Add them in the queue and also Store the distance (weight/length) from …

  8. Explanation of runtimes of BFS and DFS - Stack Overflow

    Nov 2, 2011 · Why are the running times of BFS and DFS O(V+E), especially when there is a node that has a directed edge to a node that can be reached from the vertex, like in this …

  9. BFS algorithm in Python - Stack Overflow

    BFS algorithm in Python Asked 11 years, 1 month ago Modified 1 year, 8 months ago Viewed 8k times

  10. c++ - BFS implementation - Stack Overflow

    Jan 27, 2017 · i was recently solving a bfs problem where each node is a different arrangement of elements of an array. but i was unable to come up with a suitable data structure to keep track …

Refresh