def main(): if len(sys.argv) <= 1: return g = graphs.readDirected(sys.argv[1]) compFinder = StrongComponentsFinder(g) components = compFinder.findComponents() print "Found %d components" % len(components) print components
def main(): if len(sys.argv) <= 1: return g = graphs.readDirected(sys.argv[1]) r = ReachabilityFinder(g) r.findReachables() for v in range(g.count()): print "%d reachability: %s" % (v, r.reachables(v))
def main(): if len(sys.argv) <= 1: return g = graphs.readDirected(sys.argv[1]) cycleDetect = DirectedCycleDetector(g) cycleDetect.checkCycle() print "Graph has cycle? %s" % cycleDetect.hasCycle() print "Graph cycle: %s" % cycleDetect.getCycle() print g