Use Graph object in topoSort and improve branch coverage