Created
December 25, 2019 13:59
-
-
Save mohanr/133133ce606ff5e9a3d4844c932d86a8 to your computer and use it in GitHub Desktop.
A minimal Kruskal MST implementation in Ocaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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