這裏是我的問題(路徑圖)查找兩點之間的最短路徑,動態規劃
我想尋找到F從A shothest路徑,我讀,我應該使用Dijkstra算法,我試圖做這一點,但我有設置邊緣問題:
在79線我設置的邊緣http://pastebin.com/UAZiP7qb
這是很好的選擇,以解決這種情況下,通過這種算法?我該怎麼辦?
我不能設置邊正確:
public static void main(String[] args)
{
// mark all the vertices
Vertex A = new Vertex("A");
Vertex B = new Vertex("B");
Vertex C = new Vertex("C");
Vertex D = new Vertex("D");
Vertex E = new Vertex("E");
Vertex F = new Vertex("F");
// set the edges and weight
A.adjacencies = new Edge[]{ new Edge(B, 0) };
B.adjacencies = new Edge[]{ new Edge(E, 2) };
E.adjacencies = new Edge[]{ new Edge(F, 2) };
}
請,包括在問題本身的源代碼,而不是鏈接到一些討厭的廣告填充部位。此外,請指明您的問題到底是什麼,「有問題」不夠明確。 – chill