12-06 MST Wrapup

Key question: how do you know your code produces a minimal spanning tree? Try some of these test cases.

total weight

Write a new method in the weighted graph class to return the total weight of all of the edges given.

def total_weight(self, edges: Set[Edge]]) -> int:
    return 0

test cases

generic setup

This would come first in your code, but it’s the least important so it’s last on this page.

from typing import Tuple, List, Set
Vertex = int
Edge = Tuple[Vertex, Vertex]