路由室内知道步骤

时间:2017-04-09 20:36:48

标签: c# algorithm path routing dijkstra

我需要在室内地图中创建一个具有所有连接(步骤,跳跃)的路径  比如AB, BC, BA, CB, ...。假设我必须从A转到I算法怎么样? 附:我正在开发C#,但是任何伪代码或其他资源的链接都会受到赞赏。

enter image description here

1 个答案:

答案 0 :(得分:1)

Use Breadth-First-Search (BFS) to construct a tree starting from A.

When you reach the node I, traverse the tree back up to the root (A) by repeatedly going up the parent node i.e. I -> H -> G -> F -> C -> B -> A.

As you do, you can retrieve the strings HI, GH, FG, CF, BC, AB, which you can then list backwards for your final solution.