public int[] Sort() // toplogical sort { while (_numVerts > 0) // while vertices remain, { // get a vertex with no successors, or -1 int currentVertex = noSuccessors(); if (currentVertex == -1) // must be a cycle throw new Exception("Graph has cycles");