implement topological sorting in a directed acyclic graph

represent the graph as an adjacency matrix

always choose the vertex with the lowest ID when given a choice (e.g., when iterating through the neighbors of a vertex and when selecting a vertex of in-degree 0 to start)

throw an exception if it encounters a cycle