Skip to content

Instantly share code, notes, and snippets.

@mohanr
Created December 25, 2019 13:59
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