(************************************************************ main2.ml Created : Wed Nov 6 11:18:04 2002 Last modified: Wed Nov 06 12:23:23 2002 Compile: ocamlfind ocamlc -g -I /home/tak/lib/ocaml str.cma mylib.cma graph.ml main2.ml -o main2.bc # FTP Directory: sources/ocaml # ************************************************************) (** @author Takashi Masuyama *) open Graph let test_lgraph = LGraph(["A"; "B"; "C"; "D"],[("A","B");("A","C");("B","D");("C","D")]) let _ = let (Graph(nodes,_,_)) as agraph = lgraph_to_agraph test_lgraph in let l = topological_sort (inverse_graph agraph) in List.iter (fun x -> print_endline nodes.(x)) l