Maximum Spanning Tree Algorithm Code