Ocaml 如何定义加权图?
但是,如果要将权重附加到边上,该怎么办 但是,表示图形的最佳方式是什么?为什么不直接添加它呢Ocaml 如何定义加权图?,ocaml,Ocaml,但是,如果要将权重附加到边上,该怎么办 但是,表示图形的最佳方式是什么?为什么不直接添加它呢 A graph in OCaml can be defined in this way type 'a graph = Gr of ('a * 'a) list;; let myGraph = Gr[(1,2);(1,3);(1,4);(2,6);(3,5);(4,6);(6,5);(6,7);(5,4)];; type weight = float (* or whatever *) type '
A graph in OCaml can be defined in this way
type 'a graph = Gr of ('a * 'a) list;;
let myGraph = Gr[(1,2);(1,3);(1,4);(2,6);(3,5);(4,6);(6,5);(6,7);(5,4)];;
type weight = float (* or whatever *)
type 'a graph = Gr of ('a * 'a * weight) list