def valid_graph(self, g): cycles = [a for a in nx.simple_cycles(g)] if len(cycles) > 0: return False return True