Really appreciate your help if my function on dijkstra algorithm is correct or wrong? Many thanks...
Function Dijkstra(Graph, source): Graph randomGraphGenerator = new Graph: Source V0 = new Source: for each vertex n in randomGraphGenerator: // initializations weight[n] := infinity // Unknown path // function from source to source Previous[n] := undefined weight[V0] := 0 // Distance from source to source T := copy(randomGraphGenerator) // All vertices in the graph // are unoptimized – thus are in T While T is not empty: // The main Loop u := extract_min(T) // Remove and return best vertex // from vertices in two given vertices. // we would use a path finding algorithm. // on the new graph, such as depth-first search. For each neighbour n of u: // where n has not yet been removed from T. alt = weight [u] + length(u, n) If alt < weight [n] // Relax (u, n) weight [n] := alt previous[n] := u Return previous