Python networkx DFS 或 BFS 丢失?

发布于 2024-08-25 09:22:52 字数 182 浏览 1 评论 0原文

我感兴趣的是在短时间内找到一条路径(不一定是最短的)。 Networkx 中的 Dijsktra 和 AStar 花费的时间太长。

为什么networkx中没有DFS或BFS?

我计划编写自己的 DFS 和 BFS 搜索(我更倾向于 BFS,因为我的图非常深)。我可以在networkx的库中使用什么来加速我的速度吗?

I am interested in finding a path (not necessarily shortest) in a short amount of time. Dijsktra and AStar in networkx is taking too long.

Why is there no DFS or BFS in networkx?

I plan to write my own DFS and BFS search (I am leaning more towards BFS because my graph is pretty deep). Is there anything that I can use in networkx's lib to speed me up?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

音盲 2024-09-01 09:22:52

遍历模块具有多种深度优先搜索变体。广度优先搜索在连接组件函数中实现 ,也在该模块中。要么使用它,要么如果您需要自定义行为,请使用它作为示例重新实现您自己的行为。

The Traversal module has multiple depth-first-search variations. Breadth-first-search is implemented in the connected components functions, also in that module. Either use that, or if you need custom behaviour, re-implement your own using that as the example.

×眷恋的温暖 2024-09-01 09:22:52

现在有深度优先搜索和广度优先搜索这里

这些是根据 www.ics.uci.edu/~eppstein/PADS 上的 Eppstein 代码修改的
这也是寻找 Python 图算法的好地方。

There is now a depth-first search and breadth-first search here

These are modified from Eppstein's code at www.ics.uci.edu/~eppstein/PADS
which is also a good place to look for Python graph algorithms.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文