diff --git a/.gitignore b/.gitignore index 248df3a..21eaef1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ /_build/ .gitignore ftest.native -ftest.byte \ No newline at end of file +ftest.byte +test.svg \ No newline at end of file diff --git a/_build/_digests b/_build/_digests index 2a54dc8..863c671 100644 --- a/_build/_digests +++ b/_build/_digests @@ -1,29 +1,30 @@ "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 )": "\200\209\169o\127\030m\142\170\028>\188\236\007\1540" "Rule: ocaml: ml & cmi -> cmx & o (%=src/gfile )": "\236O\148Y\157m\028\183\166?\231a\231\187u\132" -"Rule: ocaml dependencies ml (%=src/ftest )": "b\201\017\148\224\147!\233\229\244\171s\194\180\207\183\168" +"Resource: /home/chepycou/Documents/cours/4-IR/functionalProgramming/Projet/repoGit/ocaml-maxflow-project/src/ftest.ml": "5P\231\174\024\150\154\226\128U\190\156\229\r\211\229" "Rule: ocaml: mli -> cmi (%=src/graph )": ")2\159\205\136\031\251\145\0263\01878\001\b\134" "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" -"Resource: /home/chepycou/Documents/cours/4-IR/functionalProgramming/Projet/repoGit/ocaml-maxflow-project/src/tools.ml": "\021\223v\253\172\1820\185\180f[\180\189P\r)" -"Rule: ocaml: cmx* & o* -> native (%=src/ftest )": "\028v\248\005\138\247 \162\160\253\214\194a\167\011\174" +"Resource: /home/chepycou/Documents/cours/4-IR/functionalProgramming/Projet/repoGit/ocaml-maxflow-project/src/tools.ml": "\020m\226\134\024>H\2363\159\169\203\168\222m\205" "Rule: ocaml: mli -> cmi (%=src/tools )": "*\130\\\221>3X\156\180\205\"\245\255-\230~" -"Rule: ocaml: ml & cmi -> cmx & o (%=src/ftest )": "\237\160\207\006\164Q\152#\240Q\196\136\242\206'\194" +"Rule: ocaml: cmx* & o* -> native (%=src/ftest )": "\207\160\000\019\137\232\202\016\241\146\200\215\025\236Ne" +"Rule: ocaml: ml & cmi -> cmx & o (%=src/ftest )": "\191^\023\176^\212\131yAC^\234\229N<\168" "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`" +"Rule: ocaml dependencies ml (%=src/tools )": "\233\000A\192\r\246.I\244p]yG\219\212{" "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 )": "u\207\140\137\026\138+o\170\142E\195\193\183k9" "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 )": ":=\223\176n\222\012\220\136\154\171h\019\1591\176" -"Resource: /home/alejeune/Documents/4ir/S1/Ocaml/FordFulkersonLeChameau/src/gfile.ml": "\1966\177\141\185,fpl\1987gT\128b\028" +"Rule: ocaml: ml -> cmo & cmi (%=src/ftest )": "#9\227\199\183\221bM\251\240\246z\153\003\023\141" +"Rule: ocaml: ml & cmi -> cmx & o (%=src/tools )": "\233h{v\154Q\000\2511\168h\241\181\020\153\169" "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" "Resource: /home/chepycou/Documents/cours/4-IR/functionalProgramming/Projet/repoGit/ocaml-maxflow-project/src/tools.mli": "9\173\222\177]e\245\229\131\151\020fsu\133@" "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" "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 )": "\22566|\026\\\138\197K\020\155\144/$\219\161" +"Rule: ocaml dependencies ml (%=src/gfile )": "U4(<\t=rQ\240c\0278\231N\1949" diff --git a/_build/_log b/_build/_log index 4142a45..24f8386 100644 --- a/_build/_log +++ b/_build/_log @@ -26,20 +26,9 @@ # 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 -+ /home/chepycou/.opam/4.14.0/bin/ocamlopt.opt -c -I src -o src/tools.cmx src/tools.ml -File "src/tools.ml", line 1: -Error: The implementation src/tools.ml - does not match the interface src/tools.cmi: - Values do not match: - val gmap : 'a Graph.graph -> ('a -> int) -> int Graph.graph - is not included in - val gmap : 'a Graph.graph -> ('a -> 'b) -> 'b Graph.graph - The type 'a Graph.graph -> ('a -> int) -> int Graph.graph - is not compatible with the type - 'a Graph.graph -> ('a -> 'b) -> 'b Graph.graph - Type int is not compatible with type 'b - File "src/tools.mli", line 4, characters 0-44: Expected declaration - File "src/tools.ml", line 16, characters 4-8: Actual declaration -Command exited with code 2. -# Compilation unsuccessful. +/home/chepycou/.opam/4.14.0/bin/ocamlopt.opt -c -I src -o src/tools.cmx src/tools.ml # cached +# 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/tools.cmx src/ftest.cmx -o src/ftest.native # cached +# Compilation successful. diff --git a/_build/src/ftest.cmo b/_build/src/ftest.cmo index 9e9cd00..6d64bfa 100644 Binary files a/_build/src/ftest.cmo and b/_build/src/ftest.cmo differ diff --git a/_build/src/ftest.cmx b/_build/src/ftest.cmx index b50bfa3..1e8e4af 100644 Binary files a/_build/src/ftest.cmx and b/_build/src/ftest.cmx differ diff --git a/_build/src/ftest.ml b/_build/src/ftest.ml index 844badc..1089dd4 100644 --- a/_build/src/ftest.ml +++ b/_build/src/ftest.ml @@ -29,8 +29,14 @@ let () = (* Open file *) let graph = from_file infile in + let graphInt = gmap graph int_of_string in + + let graphBis = add_arc graphInt 0 3 5 in + + let graphFinal = gmap graphBis string_of_int in + (* Rewrite the graph that has been read. *) - let () = write_file outfile graph in + let () = write_file outfile graphFinal in () diff --git a/_build/src/ftest.native b/_build/src/ftest.native index 9869e1b..5c8810d 100755 Binary files a/_build/src/ftest.native and b/_build/src/ftest.native differ diff --git a/_build/src/ftest.o b/_build/src/ftest.o index f6cfc23..faf7fd4 100644 Binary files a/_build/src/ftest.o and b/_build/src/ftest.o differ diff --git a/ftest.native b/ftest.native index f454e14..e1b4378 120000 --- a/ftest.native +++ b/ftest.native @@ -1 +1 @@ -/home/alejeune/Documents/4ir/S1/Ocaml/FordFulkersonLeChameau/_build/src/ftest.native \ No newline at end of file +/home/chepycou/Documents/cours/4-IR/functionalProgramming/Projet/repoGit/ocaml-maxflow-project/_build/src/ftest.native \ No newline at end of file diff --git a/outfile b/outfile index ac2c9cd..3b4fbe8 100644 --- a/outfile +++ b/outfile @@ -7,9 +7,6 @@ n 3.0 1.0 n 4.0 1.0 n 5.0 1.0 -e 0 2 8 -e 0 3 10 -e 0 1 7 e 2 4 12 e 3 4 5 e 3 2 2 @@ -17,5 +14,8 @@ e 3 1 11 e 1 4 1 e 1 5 21 e 4 5 14 +e 0 2 8 +e 0 1 7 +e 0 3 15 % End of graph diff --git a/src/ftest.ml b/src/ftest.ml index 844badc..1089dd4 100644 --- a/src/ftest.ml +++ b/src/ftest.ml @@ -29,8 +29,14 @@ let () = (* Open file *) let graph = from_file infile in + let graphInt = gmap graph int_of_string in + + let graphBis = add_arc graphInt 0 3 5 in + + let graphFinal = gmap graphBis string_of_int in + (* Rewrite the graph that has been read. *) - let () = write_file outfile graph in + let () = write_file outfile graphFinal in () diff --git a/src/tools.ml b/src/tools.ml index 1937ab6..be446ee 100644 --- a/src/tools.ml +++ b/src/tools.ml @@ -12,6 +12,5 @@ let add_arc g id1 id2 n = | Some a -> new_arc g id1 id2 (n + a) (* maps all arcs of gr by function f *) -let gmap gr f = e_fold gr (fun acc id1 id2 x -> add_arc acc id1 id2 (f x)) (clone_nodes gr) - (*TODO : ici rajouter un new_arc plutôt qu'un add_arc*) +let gmap gr f = e_fold gr (fun acc id1 id2 x -> new_arc acc id1 id2 (f x)) (clone_nodes gr)