================================================================================ Problem 1: public boolean hasSelfCycle( Graphnode node ) { return hasSelfCycle(node, node); } private boolean hasSelfCycle(Graphnode node, Graphnode goal) { node.setVisitMark(true); for (Graphnode succ : node.getSuccessors()) { if (succ == goal) // if we've reached the first node return true; // there is a self cycle else if (!succ.getVisitMark()) { if (hasSelfCycle(succ, goal)) return true; } } return false; } ================================================================================ Problem 2: Visited Vertexes and their Priority Queue's items shortest distances from start (listed in increasing order) - ( 0, S) S:0 ( 4, G), (11, H), (33, P) S:0, G:4 (10, R), (11, H), (33, P) S:0, G:4, R:10 (11, H), (24, P), (30, A) S:0, G:4, R:10, H:11 (12, P), (30, A) S:0, G:4, R:10, H:11, P:12 (14, A) S:0, G:4, R:10, H:11, P:12, A:14 empty ================================================================================ Problem 3: Possible topological orderings (only 2 required): A C D B E F A C D E B F C A D B E F C A D E B F C D A B E F C D A E B F