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