Run auto format on sources
This commit is contained in:
parent
4901986d80
commit
7255fb2c3d
4 changed files with 12 additions and 12 deletions
|
@ -1,5 +1,5 @@
|
||||||
open Gfile
|
open Gfile
|
||||||
|
|
||||||
let () =
|
let () =
|
||||||
|
|
||||||
(* Check the number of command-line arguments *)
|
(* Check the number of command-line arguments *)
|
||||||
|
@ -11,10 +11,10 @@ let () =
|
||||||
|
|
||||||
|
|
||||||
(* Arguments are : infile(1) source-id(2) sink-id(3) outfile(4) *)
|
(* Arguments are : infile(1) source-id(2) sink-id(3) outfile(4) *)
|
||||||
|
|
||||||
let infile = Sys.argv.(1)
|
let infile = Sys.argv.(1)
|
||||||
and outfile = Sys.argv.(4)
|
and outfile = Sys.argv.(4)
|
||||||
|
|
||||||
(* These command-line arguments are not used for the moment. *)
|
(* These command-line arguments are not used for the moment. *)
|
||||||
and _source = int_of_string Sys.argv.(2)
|
and _source = int_of_string Sys.argv.(2)
|
||||||
and _sink = int_of_string Sys.argv.(3)
|
and _sink = int_of_string Sys.argv.(3)
|
||||||
|
|
12
src/gfile.ml
12
src/gfile.ml
|
@ -1,6 +1,6 @@
|
||||||
open Graph
|
open Graph
|
||||||
open Printf
|
open Printf
|
||||||
|
|
||||||
type path = string
|
type path = string
|
||||||
|
|
||||||
(* Format of text files:
|
(* Format of text files:
|
||||||
|
@ -16,7 +16,7 @@ type path = string
|
||||||
e 3 1 11
|
e 3 1 11
|
||||||
e 0 2 8
|
e 0 2 8
|
||||||
|
|
||||||
*)
|
*)
|
||||||
|
|
||||||
let write_file path graph =
|
let write_file path graph =
|
||||||
|
|
||||||
|
@ -32,9 +32,9 @@ let write_file path graph =
|
||||||
|
|
||||||
(* Write all arcs *)
|
(* Write all arcs *)
|
||||||
e_iter graph (fun id1 id2 lbl -> fprintf ff "e %d %d %s\n" id1 id2 lbl) ;
|
e_iter graph (fun id1 id2 lbl -> fprintf ff "e %d %d %s\n" id1 id2 lbl) ;
|
||||||
|
|
||||||
fprintf ff "\n%% End of graph\n" ;
|
fprintf ff "\n%% End of graph\n" ;
|
||||||
|
|
||||||
close_out ff ;
|
close_out ff ;
|
||||||
()
|
()
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ let from_file path =
|
||||||
in
|
in
|
||||||
|
|
||||||
let final_graph = loop 0 empty_graph in
|
let final_graph = loop 0 empty_graph in
|
||||||
|
|
||||||
close_in infile ;
|
close_in infile ;
|
||||||
final_graph
|
final_graph
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ let new_arc gr id1 id2 lbl =
|
||||||
(* Update out-arcs.
|
(* Update out-arcs.
|
||||||
* remove_assoc does not fail if id2 is not bound. *)
|
* remove_assoc does not fail if id2 is not bound. *)
|
||||||
let outb = (id2, lbl) :: List.remove_assoc id2 outa in
|
let outb = (id2, lbl) :: List.remove_assoc id2 outa in
|
||||||
|
|
||||||
(* Replace out-arcs in the graph. *)
|
(* Replace out-arcs in the graph. *)
|
||||||
let gr2 = List.remove_assoc id1 gr in
|
let gr2 = List.remove_assoc id1 gr in
|
||||||
(id1, outb) :: gr2
|
(id1, outb) :: gr2
|
||||||
|
|
|
@ -37,7 +37,7 @@ type 'a out_arcs = (id * 'a) list
|
||||||
val out_arcs: 'a graph -> id -> 'a out_arcs
|
val out_arcs: 'a graph -> id -> 'a out_arcs
|
||||||
|
|
||||||
(* find_arc gr id1 id2 finds an arc between id1 and id2 and returns its label. Returns None if the arc does not exist.
|
(* find_arc gr id1 id2 finds an arc between id1 and id2 and returns its label. Returns None if the arc does not exist.
|
||||||
* @raise Graph_error if id1 is unknown. *)
|
* @raise Graph_error if id1 is unknown. *)
|
||||||
val find_arc: 'a graph -> id -> id -> 'a option
|
val find_arc: 'a graph -> id -> id -> 'a option
|
||||||
|
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ val n_iter: 'a graph -> (id -> unit) -> unit
|
||||||
|
|
||||||
(* Like n_iter, but the nodes are sorted. *)
|
(* Like n_iter, but the nodes are sorted. *)
|
||||||
val n_iter_sorted: 'a graph -> (id -> unit) -> unit
|
val n_iter_sorted: 'a graph -> (id -> unit) -> unit
|
||||||
|
|
||||||
(* Fold on all (unsorted) nodes. You must remember what List.fold_left does. *)
|
(* Fold on all (unsorted) nodes. You must remember what List.fold_left does. *)
|
||||||
val n_fold: 'a graph -> ('b -> id -> 'b) -> 'b -> 'b
|
val n_fold: 'a graph -> ('b -> id -> 'b) -> 'b -> 'b
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue