Minimum Spanning Tree by ksk

open List
let rec f l=try Scanf.scanf"%s %s %d "(fun v w n->f([n,v,w]@l))with
_->fold_left(fun m(n,v,w)->let(!)i=find(mem i)(m@[[i]])in
let e,b=if!v= !w then!v,"F"else!v@ !w,"T"in
Printf.printf"%s %s %s %d
"b v w n;e::m)[](Sort.list(<)l);;f[]

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page