您如何表示网格中的障碍物作为图形
我的程序将*探索算法与Dijkstra的算法进行了比较,以显示知情搜索比未知的更好。在写入中,我解释了网格实际上是如何在点点段之间相等距离的图表,以至于grid(0,0)
and grid(0,1)
是节点,它们之间的移动是图的边缘。
我也以视觉表示。
我的问题是您如何代表图形形式的障碍? (障碍物被定义为无法穿越的网格位置。
是否是a)节点无法实现
或者是b)指示允许in in in in in in in in in Direction而且,应该避免它?
my program compares A* pathfinding algorithm to dijkstra's algorithm showing how informed searches are better than uninformed. in the write up i explained how a grid is actually a graph with equal distance between noded as such that grid(0,0)
and grid(0,1)
are nodes, and the moving between them is the edges of the graph.
i also represented it visually.
my question is how would you represent an obstacle in graph form? (An obstacle is defined as a grid Position that cannot be traversed.
would it be a) where the node is unreachable
or would it be b) where the directions allow an in but not and out, so it should be avoided?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
建议(a)和(c)完全相同,(a)采取更大的内存(取决于您如何实现整个问题并将其模型为图形)。如果您的用例需要报告当前的操作导致下沉/错误/未允许的状态,则可能会有建议(b),因此,如果您只需要比较算法,那么我认为不必考虑它。
Suggestions (a) and (c) are exactly the same, with (a) taking a little bit larger memory (depending on how you implement the whole problem and model it as a graph). Suggestion (b) is possible if your use-case needs to report that the current action leads to a sink/error/not-allowed state, so if you just need to compare algorithms then I think it is not necessary to consider it.