Skip to content

Instantly share code, notes, and snippets.

@mohanr

mohanr/kruskal.ml

Created Dec 25, 2019
Embed
What would you like to do?
A minimal Kruskal MST implementation in Ocaml
type edge = ( int * int * int ) list
module type EDGECOMPARE = sig
type t
val compare : 'a list -> 'a list ->bool
end
module EDGECOMPARE_weight : EDGECOMPARE with type t = edge = struct
type t = edge
let compare l r = ( List.nth l ( List.length l/ 2 )) == ( List.nth r (List.length r/2))
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.