first attempt at displaying the difference graph : Todo ==> replace with ints
This commit is contained in:
parent
33d1c3a80b
commit
9ef1bef8c7
16 changed files with 189 additions and 168 deletions
|
@ -1,42 +1,42 @@
|
|||
"Rule: ocaml dependencies mli (%=src/gfile )": "7\182\192g\020\238\188\b\211\164{\014\157\135\011\003"
|
||||
"Rule: ocaml: ml & cmi -> cmx & o (%=src/display )": "\027\"r\253b.\004\234\141\ba\206\238\025\242r"
|
||||
"Rule: ocaml dependencies mli (%=src/gfile )": "7\182\192g\020\238\188\b\211\164{\014\157\135\011\003"
|
||||
"Resource: /home/alejeune/Documents/4ir/S1/Ocaml/FordFulkersonLeChameau/src/tools.mli": "9\173\222\177]e\245\229\131\151\020fsu\133@"
|
||||
"Rule: ocaml dependencies ml (%=src/ftest )": "\022\160\161\193C\022\254\133j\146\196\000-~(\161"
|
||||
"Rule: ocaml: ml & cmi -> cmx & o (%=src/gfile )": "\236O\148Y\157m\028\183\166?\231a\231\187u\132"
|
||||
"Rule: ocaml dependencies ml (%=src/ftest )": "\252\019/\001\247\140\132b\221\205\237\217\194\139\011\245"
|
||||
"Rule: ocaml dependencies mli (%=src/display )": "B+\230S\204^\178D\253\139t\200\194%5b"
|
||||
"Resource: /home/chepycou/Documents/cours/4-IR/functionalProgramming/Projet/repoGit/ocaml-maxflow-project/src/ftest.ml": "\185\019Y\252\019n*\004\218s\243\024\173}Zd"
|
||||
"Resource: /home/chepycou/Documents/cours/4-IR/functionalProgramming/Projet/repoGit/ocaml-maxflow-project/src/fordFulkerson.ml": "q\184\138\153\242\011%\207\178\202b\006\1654D\243"
|
||||
"Rule: ocaml: mli -> cmi (%=src/display )": "UAU\224\168o\2429OM\253\194i'\218N"
|
||||
"Rule: ocaml dependencies mli (%=src/display )": "+\178\012\248)#\197\218\144\1935\220\193\190\212\183"
|
||||
"Resource: /home/chepycou/Documents/cours/4-IR/functionalProgramming/Projet/repoGit/ocaml-maxflow-project/src/ftest.ml": "\204\235D\031\004O\173\136R\148y\171\207]&g"
|
||||
"Resource: /home/chepycou/Documents/cours/4-IR/functionalProgramming/Projet/repoGit/ocaml-maxflow-project/src/fordFulkerson.ml": "qra\159@\212u\200\192\132V9-\127\2022"
|
||||
"Rule: ocaml: mli -> cmi (%=src/graph )": ")2\159\205\136\031\251\145\0263\01878\001\b\134"
|
||||
"Rule: ocaml: mli -> cmi (%=src/display )": "\020\015~%\135\196\153\152}\154\244v\253$N\164"
|
||||
"Resource: /home/chepycou/Documents/cours/4-IR/functionalProgramming/Projet/repoGit/ocaml-maxflow-project/src/graph.mli": "\253S\031\015\162|\210x\252\n \227\001{\133e"
|
||||
"Rule: ocaml: ml & cmi -> cmx & o (%=src/fordFulkerson )": "\158P\156*\236\171\2120>1Z\179\149\240\201."
|
||||
"Resource: /home/chepycou/Documents/cours/4-IR/functionalProgramming/Projet/repoGit/ocaml-maxflow-project/src/tools.ml": "\185\244\209\136L\1577;\191J\171\162M\135xa"
|
||||
"Rule: ocaml: ml & cmi -> cmx & o (%=src/fordFulkerson )": "\128\136\201\143^_\n3V\177lE3\1654\139"
|
||||
"Rule: ocaml: cmx* & o* -> native (%=src/ftest )": "u8i\1621\017rk\197\200ZA\n;d\b"
|
||||
"Rule: ocaml: mli -> cmi (%=src/tools )": "\239.\206\1667\139\246~\227$\235l\012\210\208;"
|
||||
"Rule: ocaml: mli -> cmi (%=src/fordFulkerson )": ";\199h\213Q\200\225\024\160\204\r\225\r\203\155\\"
|
||||
"Rule: ocaml: ml & cmi -> cmx & o (%=src/ftest )": "\160l\238\232%a\145\130\240\152J#\031_\024\199"
|
||||
"Rule: ocaml: cmx* & o* -> native (%=src/ftest )": "O\\\249\200\251,\018\028\206cr\144\204\180\181\214"
|
||||
"Rule: ocaml: ml & cmi -> cmx & o (%=src/ftest )": "8u\155\140\162\183(4F\239\206\198\150\176\162\227"
|
||||
"Rule: ocaml: mli -> cmi (%=src/fordFulkerson )": "\206\016hD\235I\220+\252\2129\195G\179\151g"
|
||||
"Resource: /home/alejeune/Documents/4ir/S1/Ocaml/FordFulkersonLeChameau/src/graph.ml": "\005\175.\2458\176E\202]\255\235=9\015\000\237"
|
||||
"Resource: /home/chepycou/Documents/cours/4-IR/functionalProgramming/Projet/repoGit/ocaml-maxflow-project/src/graph.ml": "\005\175.\2458\176E\202]\255\235=9\015\000\237"
|
||||
"Rule: ocaml: mli -> cmi (%=src/gfile )": "\015\211&r\030l{}\183\187\236\2266\022\129\191"
|
||||
"Resource: /home/alejeune/Documents/4ir/S1/Ocaml/FordFulkersonLeChameau/src/graph.mli": "\031\217\135\022\208\254\154\148\252)\210\130\174\215X\031"
|
||||
"Resource: /home/alejeune/Documents/4ir/S1/Ocaml/FordFulkersonLeChameau/src/gfile.mli": "\203\249\163Ct\234\0067d}\142\011m8T`"
|
||||
"Resource: /home/alejeune/Documents/4ir/S1/Ocaml/FordFulkersonLeChameau/src/tools.ml": "~[\186\208\199\129\006\030\012\196\245\183'\163\211&"
|
||||
"Rule: ocaml dependencies ml (%=src/tools )": "\228\210\133\187`\193\179>\031\016\197\147\221\006j\017"
|
||||
"Resource: /home/alejeune/Documents/4ir/S1/Ocaml/FordFulkersonLeChameau/src/tools.ml": "~[\186\208\199\129\006\030\012\196\245\183'\163\211&"
|
||||
"Resource: /home/alejeune/Documents/4ir/S1/Ocaml/FordFulkersonLeChameau/src/ftest.ml": "~\190 \235\142\210\r\222\253\136>\194\180\207\183\168"
|
||||
"Rule: ocaml: ml -> cmo & cmi (%=src/ftest )": "\211\163\255\143]\195\185\150\159\224r\005\232\206\148="
|
||||
"Rule: ocaml dependencies mli (%=src/fordFulkerson )": "\175u\223\222e6\175\017\025\014\220\011\127\150\218t"
|
||||
"Resource: /home/chepycou/Documents/cours/4-IR/functionalProgramming/Projet/repoGit/ocaml-maxflow-project/src/fordFulkerson.mli": "t\243u\229\130\149\185\161\226\030|\1607\130?+"
|
||||
"Resource: /home/chepycou/Documents/cours/4-IR/functionalProgramming/Projet/repoGit/ocaml-maxflow-project/src/display.mli": "j\141\168#\004\174\151?]\022hm\211,\164\147"
|
||||
"Rule: ocaml: ml -> cmo & cmi (%=src/ftest )": "aTb\021\214\239K\186C,\231\n\012T'\136"
|
||||
"Resource: /home/chepycou/Documents/cours/4-IR/functionalProgramming/Projet/repoGit/ocaml-maxflow-project/src/fordFulkerson.mli": "_;(\155\176\"\225\011\230\191\031M\168\250\219\170"
|
||||
"Rule: ocaml dependencies mli (%=src/fordFulkerson )": "\022\200\166Dz0\003\233z\198y\144S\162\2034"
|
||||
"Resource: /home/chepycou/Documents/cours/4-IR/functionalProgramming/Projet/repoGit/ocaml-maxflow-project/src/display.mli": "\129\140,\157Z\158D\177\144\227\139t\029Y\253\019"
|
||||
"Rule: ocaml: ml & cmi -> cmx & o (%=src/tools )": "z\158\235\155v\003\214Q\150\t\224\"\026\246(\158"
|
||||
"Rule: ocaml dependencies ml (%=src/fordFulkerson )": "\216\216\252\019\234{jF\249\249u\001fe\0241"
|
||||
"Resource: /home/alejeune/Documents/4ir/S1/Ocaml/FordFulkersonLeChameau/src/gfile.ml": "\1966\177\141\185,fpl\1987gT\128b\028"
|
||||
"Resource: /home/chepycou/Documents/cours/4-IR/functionalProgramming/Projet/repoGit/ocaml-maxflow-project/src/gfile.ml": "\1966\177\141\185,fpl\1987gT\128b\028"
|
||||
"Resource: /home/alejeune/Documents/4ir/S1/Ocaml/FordFulkersonLeChameau/src/gfile.ml": "\1966\177\141\185,fpl\1987gT\128b\028"
|
||||
"Rule: ocaml dependencies ml (%=src/fordFulkerson )": "P\128\241\162\216\228\240\163<\168\241\235\129v\231\185"
|
||||
"Resource: /home/chepycou/Documents/cours/4-IR/functionalProgramming/Projet/repoGit/ocaml-maxflow-project/src/tools.mli": "\025v\144\241\237\241\b\248\197tD\012\171\216\202\148"
|
||||
"Rule: ocaml: ml & cmi -> cmx & o (%=src/graph )": "\190\tV\232\254i\031+\141\154\168\219\155n\156C"
|
||||
"Rule: ocaml dependencies ml (%=src/graph )": "\137kk#\140\236\011\255?\132T\225M\018\169\224"
|
||||
"Rule: ocaml dependencies mli (%=src/graph )": "\012\213_n\023=\207kZ+\251(^M\2028"
|
||||
"Rule: ocaml dependencies ml (%=src/display )": "\162K\\\156\237a\012\132\237\169\243\248\212Sb\221"
|
||||
"Rule: ocaml dependencies mli (%=src/graph )": "\012\213_n\023=\207kZ+\251(^M\2028"
|
||||
"Resource: /home/chepycou/Documents/cours/4-IR/functionalProgramming/Projet/repoGit/ocaml-maxflow-project/src/gfile.mli": "\203\249\163Ct\234\0067d}\142\011m8T`"
|
||||
"Rule: ocaml dependencies ml (%=src/gfile )": "U4(<\t=rQ\240c\0278\231N\1949"
|
||||
"Rule: ocaml dependencies mli (%=src/tools )": "\151\181\0055\199\150&\017\021_\215\015\215\018\027+"
|
||||
"Rule: ocaml dependencies ml (%=src/gfile )": "U4(<\t=rQ\240c\0278\231N\1949"
|
||||
"Resource: /home/chepycou/Documents/cours/4-IR/functionalProgramming/Projet/repoGit/ocaml-maxflow-project/src/display.ml": "y\135\165\238\138M)N\224\237\005 \027+d\t"
|
||||
|
|
43
_build/_log
43
_build/_log
|
@ -2,7 +2,7 @@
|
|||
# Target: src/ftest.ml.depends, tags: { extension:ml, file:src/ftest.ml, include, ocaml, ocamldep, quiet, traverse }
|
||||
/home/chepycou/.opam/4.14.0/bin/ocamldep.opt -modules src/ftest.ml > src/ftest.ml.depends # cached
|
||||
# Target: src/display.mli.depends, tags: { extension:mli, file:src/display.mli, include, ocaml, ocamldep, quiet, traverse }
|
||||
/home/chepycou/.opam/4.14.0/bin/ocamldep.opt -modules src/display.mli > src/display.mli.depends # cached
|
||||
/home/chepycou/.opam/4.14.0/bin/ocamldep.opt -modules src/display.mli > src/display.mli.depends
|
||||
# Target: src/gfile.mli.depends, tags: { extension:mli, file:src/gfile.mli, include, ocaml, ocamldep, quiet, traverse }
|
||||
/home/chepycou/.opam/4.14.0/bin/ocamldep.opt -modules src/gfile.mli > src/gfile.mli.depends # cached
|
||||
# Target: src/graph.mli.depends, tags: { extension:mli, file:src/graph.mli, include, ocaml, ocamldep, quiet, traverse }
|
||||
|
@ -11,40 +11,23 @@
|
|||
/home/chepycou/.opam/4.14.0/bin/ocamlc.opt -c -I src -o src/graph.cmi src/graph.mli # cached
|
||||
# Target: src/gfile.cmi, tags: { byte, compile, extension:mli, file:src/gfile.mli, include, interf, ocaml, quiet, traverse }
|
||||
/home/chepycou/.opam/4.14.0/bin/ocamlc.opt -c -I src -o src/gfile.cmi src/gfile.mli # cached
|
||||
# Target: src/display.cmi, tags: { byte, compile, extension:mli, file:src/display.mli, include, interf, ocaml, quiet, traverse }
|
||||
/home/chepycou/.opam/4.14.0/bin/ocamlc.opt -c -I src -o src/display.cmi src/display.mli # cached
|
||||
# Target: src/fordFulkerson.mli.depends, tags: { extension:mli, file:src/fordFulkerson.mli, include, ocaml, ocamldep, quiet, traverse }
|
||||
/home/chepycou/.opam/4.14.0/bin/ocamldep.opt -modules src/fordFulkerson.mli > src/fordFulkerson.mli.depends # cached
|
||||
# Target: src/display.cmi, tags: { byte, compile, extension:mli, file:src/display.mli, include, interf, ocaml, quiet, traverse }
|
||||
/home/chepycou/.opam/4.14.0/bin/ocamlc.opt -c -I src -o src/display.cmi src/display.mli
|
||||
# Target: src/tools.mli.depends, tags: { extension:mli, file:src/tools.mli, include, ocaml, ocamldep, quiet, traverse }
|
||||
/home/chepycou/.opam/4.14.0/bin/ocamldep.opt -modules src/tools.mli > src/tools.mli.depends # cached
|
||||
# Target: src/tools.cmi, tags: { byte, compile, extension:mli, file:src/tools.mli, include, interf, ocaml, quiet, traverse }
|
||||
/home/chepycou/.opam/4.14.0/bin/ocamlc.opt -c -I src -o src/tools.cmi src/tools.mli # cached
|
||||
# Target: src/fordFulkerson.cmi, tags: { byte, compile, extension:mli, file:src/fordFulkerson.mli, include, interf, ocaml, quiet, traverse }
|
||||
/home/chepycou/.opam/4.14.0/bin/ocamlc.opt -c -I src -o src/fordFulkerson.cmi src/fordFulkerson.mli # cached
|
||||
/home/chepycou/.opam/4.14.0/bin/ocamlc.opt -c -I src -o src/fordFulkerson.cmi src/fordFulkerson.mli
|
||||
# Target: src/ftest.cmo, tags: { byte, compile, extension:cmo, extension:ml, file:src/ftest.cmo, file:src/ftest.ml, implem, include, ocaml, quiet, traverse }
|
||||
/home/chepycou/.opam/4.14.0/bin/ocamlc.opt -c -I src -o src/ftest.cmo src/ftest.ml # cached
|
||||
# Target: src/display.ml.depends, tags: { extension:ml, file:src/display.ml, include, ocaml, ocamldep, quiet, traverse }
|
||||
/home/chepycou/.opam/4.14.0/bin/ocamldep.opt -modules src/display.ml > src/display.ml.depends # cached
|
||||
# Target: src/gfile.ml.depends, tags: { extension:ml, file:src/gfile.ml, include, ocaml, ocamldep, quiet, traverse }
|
||||
/home/chepycou/.opam/4.14.0/bin/ocamldep.opt -modules src/gfile.ml > src/gfile.ml.depends # cached
|
||||
# Target: src/graph.ml.depends, tags: { extension:ml, file:src/graph.ml, include, ocaml, ocamldep, quiet, traverse }
|
||||
/home/chepycou/.opam/4.14.0/bin/ocamldep.opt -modules src/graph.ml > src/graph.ml.depends # cached
|
||||
# Target: src/graph.cmx, tags: { compile, extension:cmx, extension:ml, file:src/graph.cmx, file:src/graph.ml, implem, include, native, ocaml, quiet, traverse }
|
||||
/home/chepycou/.opam/4.14.0/bin/ocamlopt.opt -c -I src -o src/graph.cmx src/graph.ml # cached
|
||||
# Target: src/gfile.cmx, tags: { compile, extension:cmx, extension:ml, file:src/gfile.cmx, file:src/gfile.ml, implem, include, native, ocaml, quiet, traverse }
|
||||
/home/chepycou/.opam/4.14.0/bin/ocamlopt.opt -c -I src -o src/gfile.cmx src/gfile.ml # cached
|
||||
# Target: src/display.cmx, tags: { compile, extension:cmx, extension:ml, file:src/display.cmx, file:src/display.ml, implem, include, native, ocaml, quiet, traverse }
|
||||
/home/chepycou/.opam/4.14.0/bin/ocamlopt.opt -c -I src -o src/display.cmx src/display.ml # cached
|
||||
# Target: src/fordFulkerson.ml.depends, tags: { extension:ml, file:src/fordFulkerson.ml, include, ocaml, ocamldep, quiet, traverse }
|
||||
/home/chepycou/.opam/4.14.0/bin/ocamldep.opt -modules src/fordFulkerson.ml > src/fordFulkerson.ml.depends
|
||||
# Target: src/tools.ml.depends, tags: { extension:ml, file:src/tools.ml, include, ocaml, ocamldep, quiet, traverse }
|
||||
/home/chepycou/.opam/4.14.0/bin/ocamldep.opt -modules src/tools.ml > src/tools.ml.depends # cached
|
||||
# Target: src/tools.cmx, tags: { compile, extension:cmx, extension:ml, file:src/tools.cmx, file:src/tools.ml, implem, include, native, ocaml, quiet, traverse }
|
||||
/home/chepycou/.opam/4.14.0/bin/ocamlopt.opt -c -I src -o src/tools.cmx src/tools.ml # cached
|
||||
# Target: src/fordFulkerson.cmx, tags: { compile, extension:cmx, extension:ml, file:src/fordFulkerson.cmx, file:src/fordFulkerson.ml, implem, include, native, ocaml, quiet, traverse }
|
||||
/home/chepycou/.opam/4.14.0/bin/ocamlopt.opt -c -I src -o src/fordFulkerson.cmx src/fordFulkerson.ml
|
||||
# Target: src/ftest.cmx, tags: { compile, extension:cmx, extension:ml, file:src/ftest.cmx, file:src/ftest.ml, implem, include, native, ocaml, quiet, traverse }
|
||||
/home/chepycou/.opam/4.14.0/bin/ocamlopt.opt -c -I src -o src/ftest.cmx src/ftest.ml # cached
|
||||
# Target: src/ftest.native, tags: { dont_link_with, extension:native, file:src/ftest.native, include, link, native, ocaml, program, quiet, traverse }
|
||||
/home/chepycou/.opam/4.14.0/bin/ocamlopt.opt -I src src/graph.cmx src/gfile.cmx src/display.cmx src/tools.cmx src/fordFulkerson.cmx src/ftest.cmx -o src/ftest.native
|
||||
# Compilation successful.
|
||||
/home/chepycou/.opam/4.14.0/bin/ocamlc.opt -c -I src -o src/ftest.cmo src/ftest.ml
|
||||
+ /home/chepycou/.opam/4.14.0/bin/ocamlc.opt -c -I src -o src/ftest.cmo src/ftest.ml
|
||||
File "src/ftest.ml", line 40, characters 43-50:
|
||||
40 | let () = exportDifference graphFinal outfile in
|
||||
^^^^^^^
|
||||
Error: This expression has type string but an expression was expected of type
|
||||
int Graph.graph
|
||||
Command exited with code 2.
|
||||
# Compilation unsuccessful.
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -33,24 +33,11 @@
|
|||
|
||||
let graphInt = gmap graph int_of_string in
|
||||
|
||||
let pathTest = way graphInt 0 5 in
|
||||
let graphSolved = main graphInt 0 5 in
|
||||
|
||||
match pathTest with
|
||||
| None -> failwith "No way"
|
||||
| Some (x,y) -> Printf.printf "%d \n" y;
|
||||
let graphFinal = gmap graphSolved string_of_int in
|
||||
|
||||
let () = List.iter (Printf.printf "%d, ") x in
|
||||
(); Printf.printf "\n";
|
||||
|
||||
|
||||
match pathTest with
|
||||
| None -> failwith "No way"
|
||||
| Some (x,y) -> let graphBis = update graphInt (x,y) in
|
||||
|
||||
|
||||
let graphFinal = gmap graphBis string_of_int in
|
||||
|
||||
let () = export graphFinal outfile in
|
||||
let () = exportDifference graphFinal outfile in
|
||||
()
|
||||
(* Rewrite the graph that has been read.
|
||||
let () = write_file outfile graphDot in
|
||||
|
|
|
@ -1 +1 @@
|
|||
src/ftest.ml: Array Display FordFulkerson Gfile List Printf Sys Tools
|
||||
src/ftest.ml: Array Display FordFulkerson Gfile Printf Sys Tools
|
||||
|
|
Binary file not shown.
Binary file not shown.
17
outfile
17
outfile
|
@ -12,15 +12,18 @@
|
|||
node [shape = circle];
|
||||
|
||||
|
||||
5 -> 1 [label = "7"];
|
||||
1 -> 5 [label = "14"];
|
||||
5 -> 1 [label = "17"];
|
||||
5 -> 4 [label = "8"];
|
||||
1 -> 5 [label = "4"];
|
||||
1 -> 3 [label = "10"];
|
||||
1 -> 0 [label = "7"];
|
||||
1 -> 4 [label = "1"];
|
||||
0 -> 3 [label = "10"];
|
||||
0 -> 2 [label = "8"];
|
||||
4 -> 5 [label = "14"];
|
||||
3 -> 1 [label = "11"];
|
||||
3 -> 1 [label = "1"];
|
||||
3 -> 0 [label = "10"];
|
||||
3 -> 2 [label = "2"];
|
||||
3 -> 4 [label = "5"];
|
||||
2 -> 4 [label = "12"];
|
||||
2 -> 0 [label = "8"];
|
||||
2 -> 4 [label = "4"];
|
||||
4 -> 2 [label = "8"];
|
||||
4 -> 5 [label = "6"];
|
||||
}
|
|
@ -2,7 +2,7 @@ open Graph
|
|||
open Printf
|
||||
open Gfile
|
||||
|
||||
let export g path =
|
||||
let exportBase g path =
|
||||
let str = e_fold
|
||||
g
|
||||
(fun x id1 id2 label -> x ^ "\n " ^ (string_of_int id1) ^ " -> " ^ (string_of_int id2) ^ " [label = \"" ^ label ^"\"];" )
|
||||
|
@ -28,3 +28,38 @@ let export g path =
|
|||
fprintf ff "%s%!" totalStr;
|
||||
close_out ff;
|
||||
()
|
||||
|
||||
|
||||
|
||||
let exportDifference gStart gEnd path =
|
||||
let findUsedCapacity gEnd id1 id2 capaStart =
|
||||
let newEdge = find_arc gEnd id1 id2 in
|
||||
match newEdge with
|
||||
| None -> capaStart
|
||||
| Some a -> capaStart - a
|
||||
in
|
||||
let str = e_fold
|
||||
gStart
|
||||
(fun x id1 id2 label -> x ^ "\n " ^ (string_of_int id1) ^ " -> " ^ (string_of_int id2) ^ " [label = \"" ^ string_of_int (findUsedCapacity gEnd id1 id2 (int_of_string label)) ^ "/" ^ label ^"\"];" )
|
||||
""
|
||||
in
|
||||
|
||||
let startStr =
|
||||
"
|
||||
digraph finite_state_machine {\n
|
||||
fontname=\"Helvetica,Arial,sans-serif\"\n
|
||||
node [fontname=\"Helvetica,Arial,sans-serif\"]\n
|
||||
edge [fontname=\"Helvetica,Arial,sans-serif\"]\n
|
||||
rankdir=LR;\n
|
||||
node [shape = circle];\n
|
||||
"
|
||||
in
|
||||
|
||||
let finishStr = "\n}" in
|
||||
|
||||
let totalStr = startStr ^ str ^ finishStr in
|
||||
|
||||
let ff = open_out path in
|
||||
fprintf ff "%s%!" totalStr;
|
||||
close_out ff;
|
||||
()
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
open Graph
|
||||
open Gfile
|
||||
val export: string graph -> path -> unit
|
||||
val exportBase: string graph -> path -> unit
|
||||
val exportDifference: string graph -> int graph -> path -> unit
|
|
@ -54,5 +54,5 @@ let rec main g idS idE =
|
|||
let path = way g idS idE in
|
||||
match path with
|
||||
| None -> g
|
||||
| Same (xs, capa) -> main (update g (xs, capa) idS IdE)
|
||||
| Some (xs, capa) -> main (update g (xs, capa)) idS idE
|
||||
|
||||
|
|
|
@ -5,5 +5,5 @@ open Display
|
|||
val way: int graph -> id -> id -> (id list * int) option
|
||||
|
||||
val update: int graph -> (id list * int) -> int graph
|
||||
(*
|
||||
*)
|
||||
|
||||
val main: int graph -> id -> id -> int graph
|
21
src/ftest.ml
21
src/ftest.ml
|
@ -33,25 +33,16 @@
|
|||
|
||||
let graphInt = gmap graph int_of_string in
|
||||
|
||||
let pathTest = way graphInt 0 5 in
|
||||
let graphSolved = main graphInt 0 5 in
|
||||
|
||||
match pathTest with
|
||||
| None -> failwith "No way"
|
||||
| Some (x,y) -> Printf.printf "%d \n" y;
|
||||
|
||||
let () = List.iter (Printf.printf "%d, ") x in
|
||||
(); Printf.printf "\n";
|
||||
let graphFinal = gmap graphSolved string_of_int in
|
||||
|
||||
|
||||
match pathTest with
|
||||
| None -> failwith "No way"
|
||||
| Some (x,y) -> let graphBis = update graphInt (x,y) in
|
||||
|
||||
|
||||
let graphFinal = gmap graphBis string_of_int in
|
||||
|
||||
let () = export graphFinal outfile in
|
||||
(*TODO : gérer les strings / non-strings ==> tout display à partir de type INT ça sera plus simple *)
|
||||
let () = exportDifference graphFinal outfile in
|
||||
()
|
||||
|
||||
|
||||
(* Rewrite the graph that has been read.
|
||||
let () = write_file outfile graphDot in
|
||||
()
|
||||
|
|
171
test.svg
171
test.svg
|
@ -4,123 +4,144 @@
|
|||
<!-- Generated by graphviz version 2.50.0 (0)
|
||||
-->
|
||||
<!-- Title: finite_state_machine Pages: 1 -->
|
||||
<svg width="468pt" height="180pt"
|
||||
viewBox="0.00 0.00 468.00 180.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 176)">
|
||||
<svg width="468pt" height="221pt"
|
||||
viewBox="0.00 0.00 468.00 221.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 217)">
|
||||
<title>finite_state_machine</title>
|
||||
<polygon fill="white" stroke="transparent" points="-4,4 -4,-176 464,-176 464,4 -4,4"/>
|
||||
<polygon fill="white" stroke="transparent" points="-4,4 -4,-217 464,-217 464,4 -4,4"/>
|
||||
<!-- 5 -->
|
||||
<g id="node1" class="node">
|
||||
<title>5</title>
|
||||
<ellipse fill="none" stroke="black" cx="18" cy="-46" rx="18" ry="18"/>
|
||||
<text text-anchor="middle" x="18" y="-42.3" font-family="Helvetica,Arial,sans-serif" font-size="14.00">5</text>
|
||||
<ellipse fill="none" stroke="black" cx="18" cy="-18" rx="18" ry="18"/>
|
||||
<text text-anchor="middle" x="18" y="-14.3" font-family="Helvetica,Arial,sans-serif" font-size="14.00">5</text>
|
||||
</g>
|
||||
<!-- 1 -->
|
||||
<g id="node2" class="node">
|
||||
<title>1</title>
|
||||
<ellipse fill="none" stroke="black" cx="106" cy="-84" rx="18" ry="18"/>
|
||||
<text text-anchor="middle" x="106" y="-80.3" font-family="Helvetica,Arial,sans-serif" font-size="14.00">1</text>
|
||||
<ellipse fill="none" stroke="black" cx="106" cy="-78" rx="18" ry="18"/>
|
||||
<text text-anchor="middle" x="106" y="-74.3" font-family="Helvetica,Arial,sans-serif" font-size="14.00">1</text>
|
||||
</g>
|
||||
<!-- 5->1 -->
|
||||
<g id="edge1" class="edge">
|
||||
<title>5->1</title>
|
||||
<path fill="none" stroke="black" d="M34.65,-53.24C40.68,-56.01 47.65,-59.18 54,-62 62.27,-65.67 71.33,-69.61 79.49,-73.12"/>
|
||||
<polygon fill="black" stroke="black" points="78.31,-76.43 88.88,-77.15 81.07,-69.99 78.31,-76.43"/>
|
||||
<text text-anchor="middle" x="62" y="-71.8" font-family="Helvetica,Arial,sans-serif" font-size="14.00">7</text>
|
||||
</g>
|
||||
<!-- 1->5 -->
|
||||
<g id="edge2" class="edge">
|
||||
<title>1->5</title>
|
||||
<path fill="none" stroke="black" d="M96.49,-68.52C90.44,-59.24 81.39,-48.25 70,-43 62.41,-39.5 53.5,-38.98 45.27,-39.73"/>
|
||||
<polygon fill="black" stroke="black" points="44.72,-36.27 35.35,-41.21 45.76,-43.19 44.72,-36.27"/>
|
||||
<text text-anchor="middle" x="62" y="-46.8" font-family="Helvetica,Arial,sans-serif" font-size="14.00">14</text>
|
||||
</g>
|
||||
<!-- 0 -->
|
||||
<g id="node3" class="node">
|
||||
<title>0</title>
|
||||
<ellipse fill="none" stroke="black" cx="186" cy="-97" rx="18" ry="18"/>
|
||||
<text text-anchor="middle" x="186" y="-93.3" font-family="Helvetica,Arial,sans-serif" font-size="14.00">0</text>
|
||||
</g>
|
||||
<!-- 1->0 -->
|
||||
<g id="edge3" class="edge">
|
||||
<title>1->0</title>
|
||||
<path fill="none" stroke="black" d="M123.92,-86.82C133.94,-88.49 146.86,-90.64 158.23,-92.54"/>
|
||||
<polygon fill="black" stroke="black" points="157.67,-95.99 168.11,-94.18 158.82,-89.09 157.67,-95.99"/>
|
||||
<text text-anchor="middle" x="146" y="-93.8" font-family="Helvetica,Arial,sans-serif" font-size="14.00">7</text>
|
||||
<path fill="none" stroke="black" d="M29.99,-31.49C36.44,-38.8 45.06,-47.62 54,-54 61.67,-59.47 70.79,-64.23 79.18,-68.02"/>
|
||||
<polygon fill="black" stroke="black" points="77.99,-71.32 88.56,-72.03 80.74,-64.89 77.99,-71.32"/>
|
||||
<text text-anchor="middle" x="62" y="-66.8" font-family="Helvetica,Arial,sans-serif" font-size="14.00">17</text>
|
||||
</g>
|
||||
<!-- 4 -->
|
||||
<g id="node4" class="node">
|
||||
<g id="node3" class="node">
|
||||
<title>4</title>
|
||||
<ellipse fill="none" stroke="black" cx="442" cy="-71" rx="18" ry="18"/>
|
||||
<text text-anchor="middle" x="442" y="-67.3" font-family="Helvetica,Arial,sans-serif" font-size="14.00">4</text>
|
||||
<ellipse fill="none" stroke="black" cx="274" cy="-43" rx="18" ry="18"/>
|
||||
<text text-anchor="middle" x="274" y="-39.3" font-family="Helvetica,Arial,sans-serif" font-size="14.00">4</text>
|
||||
</g>
|
||||
<!-- 5->4 -->
|
||||
<g id="edge2" class="edge">
|
||||
<title>5->4</title>
|
||||
<path fill="none" stroke="black" d="M36.01,-19.23C45.93,-19.97 58.68,-20.97 70,-22 133.06,-27.73 206.99,-35.69 245.9,-39.98"/>
|
||||
<polygon fill="black" stroke="black" points="245.58,-43.47 255.9,-41.09 246.35,-36.51 245.58,-43.47"/>
|
||||
<text text-anchor="middle" x="150" y="-33.8" font-family="Helvetica,Arial,sans-serif" font-size="14.00">8</text>
|
||||
</g>
|
||||
<!-- 1->5 -->
|
||||
<g id="edge3" class="edge">
|
||||
<title>1->5</title>
|
||||
<path fill="none" stroke="black" d="M95.96,-63.01C89.7,-53.77 80.61,-42.33 70,-35 62.87,-30.08 54.21,-26.49 46.06,-23.91"/>
|
||||
<polygon fill="black" stroke="black" points="46.74,-20.47 36.17,-21.17 44.87,-27.22 46.74,-20.47"/>
|
||||
<text text-anchor="middle" x="62" y="-38.8" font-family="Helvetica,Arial,sans-serif" font-size="14.00">4</text>
|
||||
</g>
|
||||
<!-- 1->4 -->
|
||||
<g id="edge4" class="edge">
|
||||
<g id="edge6" class="edge">
|
||||
<title>1->4</title>
|
||||
<path fill="none" stroke="black" d="M120.41,-72.8C135.23,-61.6 160.3,-46 185,-46 185,-46 185,-46 355,-46 376.12,-46 399.03,-53.04 415.9,-59.64"/>
|
||||
<polygon fill="black" stroke="black" points="414.96,-63.05 425.54,-63.63 417.64,-56.58 414.96,-63.05"/>
|
||||
<text text-anchor="middle" x="274" y="-49.8" font-family="Helvetica,Arial,sans-serif" font-size="14.00">1</text>
|
||||
<path fill="none" stroke="black" d="M123.83,-74.45C152.66,-68.37 211.73,-55.92 246.26,-48.64"/>
|
||||
<polygon fill="black" stroke="black" points="247.06,-52.05 256.12,-46.56 245.62,-45.2 247.06,-52.05"/>
|
||||
<text text-anchor="middle" x="194" y="-66.8" font-family="Helvetica,Arial,sans-serif" font-size="14.00">1</text>
|
||||
</g>
|
||||
<!-- 3 -->
|
||||
<g id="node5" class="node">
|
||||
<g id="node4" class="node">
|
||||
<title>3</title>
|
||||
<ellipse fill="none" stroke="black" cx="274" cy="-154" rx="18" ry="18"/>
|
||||
<text text-anchor="middle" x="274" y="-150.3" font-family="Helvetica,Arial,sans-serif" font-size="14.00">3</text>
|
||||
<ellipse fill="none" stroke="black" cx="194" cy="-109" rx="18" ry="18"/>
|
||||
<text text-anchor="middle" x="194" y="-105.3" font-family="Helvetica,Arial,sans-serif" font-size="14.00">3</text>
|
||||
</g>
|
||||
<!-- 0->3 -->
|
||||
<!-- 1->3 -->
|
||||
<g id="edge4" class="edge">
|
||||
<title>1->3</title>
|
||||
<path fill="none" stroke="black" d="M124.08,-75.98C134.26,-75.43 147.24,-75.88 158,-80 163.53,-82.12 168.82,-85.48 173.54,-89.18"/>
|
||||
<polygon fill="black" stroke="black" points="171.52,-92.06 181.35,-96.01 176.12,-86.79 171.52,-92.06"/>
|
||||
<text text-anchor="middle" x="150" y="-83.8" font-family="Helvetica,Arial,sans-serif" font-size="14.00">10</text>
|
||||
</g>
|
||||
<!-- 0 -->
|
||||
<g id="node5" class="node">
|
||||
<title>0</title>
|
||||
<ellipse fill="none" stroke="black" cx="442" cy="-152" rx="18" ry="18"/>
|
||||
<text text-anchor="middle" x="442" y="-148.3" font-family="Helvetica,Arial,sans-serif" font-size="14.00">0</text>
|
||||
</g>
|
||||
<!-- 1->0 -->
|
||||
<g id="edge5" class="edge">
|
||||
<title>0->3</title>
|
||||
<path fill="none" stroke="black" d="M201.59,-106.67C214.89,-115.48 234.75,-128.65 250.16,-138.86"/>
|
||||
<polygon fill="black" stroke="black" points="248.36,-141.87 258.63,-144.47 252.22,-136.03 248.36,-141.87"/>
|
||||
<text text-anchor="middle" x="230" y="-133.8" font-family="Helvetica,Arial,sans-serif" font-size="14.00">10</text>
|
||||
<title>1->0</title>
|
||||
<path fill="none" stroke="black" d="M110.87,-95.45C119.4,-128.73 143.15,-198 193,-198 193,-198 193,-198 363,-198 385.28,-198 406.81,-183.9 421.58,-171.31"/>
|
||||
<polygon fill="black" stroke="black" points="423.97,-173.87 429.05,-164.57 419.28,-168.67 423.97,-173.87"/>
|
||||
<text text-anchor="middle" x="274" y="-201.8" font-family="Helvetica,Arial,sans-serif" font-size="14.00">7</text>
|
||||
</g>
|
||||
<!-- 4->5 -->
|
||||
<g id="edge14" class="edge">
|
||||
<title>4->5</title>
|
||||
<path fill="none" stroke="black" d="M256.93,-36.84C234.98,-28.78 194.2,-15.09 158,-10 119.33,-4.56 74.11,-9.17 46.01,-13.32"/>
|
||||
<polygon fill="black" stroke="black" points="45.12,-9.91 35.78,-14.92 46.2,-16.83 45.12,-9.91"/>
|
||||
<text text-anchor="middle" x="150" y="-13.8" font-family="Helvetica,Arial,sans-serif" font-size="14.00">6</text>
|
||||
</g>
|
||||
<!-- 2 -->
|
||||
<g id="node6" class="node">
|
||||
<title>2</title>
|
||||
<ellipse fill="none" stroke="black" cx="354" cy="-97" rx="18" ry="18"/>
|
||||
<text text-anchor="middle" x="354" y="-93.3" font-family="Helvetica,Arial,sans-serif" font-size="14.00">2</text>
|
||||
<ellipse fill="none" stroke="black" cx="362" cy="-93" rx="18" ry="18"/>
|
||||
<text text-anchor="middle" x="362" y="-89.3" font-family="Helvetica,Arial,sans-serif" font-size="14.00">2</text>
|
||||
</g>
|
||||
<!-- 0->2 -->
|
||||
<g id="edge6" class="edge">
|
||||
<title>0->2</title>
|
||||
<path fill="none" stroke="black" d="M204.14,-97C232.84,-97 290.87,-97 325.39,-97"/>
|
||||
<polygon fill="black" stroke="black" points="325.7,-100.5 335.7,-97 325.7,-93.5 325.7,-100.5"/>
|
||||
<text text-anchor="middle" x="274" y="-100.8" font-family="Helvetica,Arial,sans-serif" font-size="14.00">8</text>
|
||||
</g>
|
||||
<!-- 4->5 -->
|
||||
<g id="edge7" class="edge">
|
||||
<title>4->5</title>
|
||||
<path fill="none" stroke="black" d="M431.98,-55.94C418.21,-35.1 389.85,0 355,0 105,0 105,0 105,0 80.34,0 55.91,-14.88 39.43,-27.72"/>
|
||||
<polygon fill="black" stroke="black" points="37.09,-25.11 31.57,-34.15 41.52,-30.52 37.09,-25.11"/>
|
||||
<text text-anchor="middle" x="230" y="-3.8" font-family="Helvetica,Arial,sans-serif" font-size="14.00">14</text>
|
||||
<!-- 4->2 -->
|
||||
<g id="edge13" class="edge">
|
||||
<title>4->2</title>
|
||||
<path fill="none" stroke="black" d="M289.98,-51.71C303.05,-59.31 322.24,-70.47 337.38,-79.27"/>
|
||||
<polygon fill="black" stroke="black" points="335.79,-82.39 346.19,-84.39 339.31,-76.34 335.79,-82.39"/>
|
||||
<text text-anchor="middle" x="318" y="-75.8" font-family="Helvetica,Arial,sans-serif" font-size="14.00">8</text>
|
||||
</g>
|
||||
<!-- 3->1 -->
|
||||
<g id="edge8" class="edge">
|
||||
<g id="edge7" class="edge">
|
||||
<title>3->1</title>
|
||||
<path fill="none" stroke="black" d="M255.79,-152.31C245.8,-151.07 233.05,-149.07 222,-146 184.26,-135.5 174.94,-130.2 142,-109 137.82,-106.31 133.46,-103.33 129.28,-100.4"/>
|
||||
<polygon fill="black" stroke="black" points="131.26,-97.51 121.09,-94.54 127.18,-103.2 131.26,-97.51"/>
|
||||
<text text-anchor="middle" x="186" y="-143.8" font-family="Helvetica,Arial,sans-serif" font-size="14.00">11</text>
|
||||
<path fill="none" stroke="black" d="M176.22,-105.22C166.15,-102.75 153.17,-99.21 142,-95 138.61,-93.72 135.1,-92.24 131.68,-90.68"/>
|
||||
<polygon fill="black" stroke="black" points="132.94,-87.41 122.41,-86.24 129.92,-93.72 132.94,-87.41"/>
|
||||
<text text-anchor="middle" x="150" y="-103.8" font-family="Helvetica,Arial,sans-serif" font-size="14.00">1</text>
|
||||
</g>
|
||||
<!-- 3->4 -->
|
||||
<g id="edge10" class="edge">
|
||||
<title>3->4</title>
|
||||
<path fill="none" stroke="black" d="M291.93,-151.66C299.93,-150.36 309.55,-148.48 318,-146 359.4,-133.85 371.4,-130.78 406,-105 411.44,-100.95 416.9,-96.11 421.84,-91.36"/>
|
||||
<polygon fill="black" stroke="black" points="424.48,-93.66 429.08,-84.12 419.54,-88.71 424.48,-93.66"/>
|
||||
<text text-anchor="middle" x="354" y="-143.8" font-family="Helvetica,Arial,sans-serif" font-size="14.00">5</text>
|
||||
<path fill="none" stroke="black" d="M208.23,-97.8C220.22,-87.66 238.09,-72.54 252.03,-60.75"/>
|
||||
<polygon fill="black" stroke="black" points="254.33,-63.38 259.7,-54.25 249.81,-58.04 254.33,-63.38"/>
|
||||
<text text-anchor="middle" x="234" y="-80.8" font-family="Helvetica,Arial,sans-serif" font-size="14.00">5</text>
|
||||
</g>
|
||||
<!-- 3->0 -->
|
||||
<g id="edge8" class="edge">
|
||||
<title>3->0</title>
|
||||
<path fill="none" stroke="black" d="M211.28,-114.1C217.14,-115.82 223.83,-117.64 230,-119 295.34,-133.39 373.41,-143.89 413.79,-148.83"/>
|
||||
<polygon fill="black" stroke="black" points="413.56,-152.33 423.91,-150.05 414.4,-145.38 413.56,-152.33"/>
|
||||
<text text-anchor="middle" x="318" y="-139.8" font-family="Helvetica,Arial,sans-serif" font-size="14.00">10</text>
|
||||
</g>
|
||||
<!-- 3->2 -->
|
||||
<g id="edge9" class="edge">
|
||||
<title>3->2</title>
|
||||
<path fill="none" stroke="black" d="M288.94,-143.81C300.52,-135.35 317.2,-123.16 330.64,-113.34"/>
|
||||
<polygon fill="black" stroke="black" points="332.9,-116.02 338.91,-107.29 328.77,-110.37 332.9,-116.02"/>
|
||||
<text text-anchor="middle" x="314" y="-130.8" font-family="Helvetica,Arial,sans-serif" font-size="14.00">2</text>
|
||||
<path fill="none" stroke="black" d="M212.14,-107.35C240.84,-104.58 298.87,-98.99 333.39,-95.66"/>
|
||||
<polygon fill="black" stroke="black" points="334.09,-99.11 343.7,-94.67 333.42,-92.14 334.09,-99.11"/>
|
||||
<text text-anchor="middle" x="274" y="-106.8" font-family="Helvetica,Arial,sans-serif" font-size="14.00">2</text>
|
||||
</g>
|
||||
<!-- 2->4 -->
|
||||
<g id="edge11" class="edge">
|
||||
<g id="edge12" class="edge">
|
||||
<title>2->4</title>
|
||||
<path fill="none" stroke="black" d="M371.58,-91.99C383.84,-88.28 400.76,-83.16 414.84,-78.91"/>
|
||||
<polygon fill="black" stroke="black" points="415.91,-82.24 424.47,-76 413.88,-75.54 415.91,-82.24"/>
|
||||
<text text-anchor="middle" x="398" y="-89.8" font-family="Helvetica,Arial,sans-serif" font-size="14.00">12</text>
|
||||
<path fill="none" stroke="black" d="M354.62,-76.39C349.05,-64.44 339.68,-49.2 326,-42 318.62,-38.11 309.76,-37.22 301.51,-37.65"/>
|
||||
<polygon fill="black" stroke="black" points="301.1,-34.17 291.55,-38.77 301.88,-41.13 301.1,-34.17"/>
|
||||
<text text-anchor="middle" x="318" y="-45.8" font-family="Helvetica,Arial,sans-serif" font-size="14.00">4</text>
|
||||
</g>
|
||||
<!-- 2->0 -->
|
||||
<g id="edge11" class="edge">
|
||||
<title>2->0</title>
|
||||
<path fill="none" stroke="black" d="M377.55,-102.71C385.98,-108.44 396.73,-115.94 406,-123 410.63,-126.52 415.5,-130.43 420.08,-134.19"/>
|
||||
<polygon fill="black" stroke="black" points="417.99,-137.01 427.91,-140.72 422.47,-131.63 417.99,-137.01"/>
|
||||
<text text-anchor="middle" x="402" y="-126.8" font-family="Helvetica,Arial,sans-serif" font-size="14.00">8</text>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
|
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 7.8 KiB |
Loading…
Reference in a new issue