Skip to content

Instantly share code, notes, and snippets.

@mohanr
Created December 25, 2019 13:59
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save mohanr/133133ce606ff5e9a3d4844c932d86a8 to your computer and use it in GitHub Desktop.
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