All the paths between 2 nodes in graph

后端 未结 4 1018
迷失自我
迷失自我 2021-01-19 03:06

I have to make an uninformed search (Breadth-first-Search) program which takes two nodes and return all the paths between them.

public void BFS(Nod start, N         


        
4条回答
  •  有刺的猬
    2021-01-19 03:37

    In the BFS algorithm you must not stop after you find a solution. One idea is to set data null for all the cities you visited except the first one and let the function run a little bit longer. I don't have time to write you a snippet but if ou don't get it i will write at least a pseudocode. If you didn't understood my idea post a comment with your question and i will try to explain better.

提交回复
热议问题