This commit is contained in:
Alexandre 2024-06-07 16:18:48 +02:00
parent 6f2b32d04a
commit 68f3e8d697
4 changed files with 9 additions and 2 deletions

BIN
a.out

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1252,7 +1252,7 @@ let another_type_of_dijkstra (gr : type2graph) r dx dy dt gwd ght =
end; end;
in in
(* Actual BFS *) (* Actual Dijkstra *)
let pq = pq_create () in let pq = pq_create () in
@ -1422,6 +1422,13 @@ let main r =
Stdlib.print_endline "Enter the height of the graph (use 6 for weighted): "; Stdlib.print_endline "Enter the height of the graph (use 6 for weighted): ";
let ht = Scanf.bscanf Scanf.Scanning.stdin "%d\n" identity in let ht = Scanf.bscanf Scanf.Scanning.stdin "%d\n" identity in
Stdlib.print_endline "Enter the density of the graph (0 ~ 100): ";
let density = ref (Scanf.bscanf Scanf.Scanning.stdin "%d\n" identity) in
if(!density < 0 || !density > 100) then begin
Stdlib.print_endline "Invalid input, will use 50 instead";
density := 50;
end;
if ht <= 0 then failwith "Error : invalid input"; if ht <= 0 then failwith "Error : invalid input";
Stdlib.print_endline "Is the grap weighted ? (0/1)"; Stdlib.print_endline "Is the grap weighted ? (0/1)";
@ -1441,7 +1448,7 @@ let main r =
let offset_x = (gwd - r)/(wd-1) - 2*r in let offset_x = (gwd - r)/(wd-1) - 2*r in
let offset_y = (ght - r)/(ht-1) - 2*r in let offset_y = (ght - r)/(ht-1) - 2*r in
let type2 = generate_type2_graph wd ht r 1 60 in let type2 = generate_type2_graph wd ht !density 1 60 in
let dt = 0.25 in let dt = 0.25 in