def none(): nodes_dictionary, _, start, end, edges_dict = dataGen() nodes_dictionary = {k:v for (k,v) in nodes_dictionary.items() if 'Black' in v.color} edges_dict = { k_:filtered for (k_, filtered) in {k:list(filter(lambda n: 'Black' in n.color, v)) for (k,v) in edges_dict.items()}.items() if filtered } if start not in nodes_dictionary: print(-1) else: start = nodes_dictionary[start] path_exists = dfs(start, end, edges_dict) print(1 if path_exists else -1)
def alternate(): nodes_dictionary, _, start, end, edges_dict = dataGen() start = nodes_dictionary[start] is_alternating = dfs(start, end, edges_dict) print(is_alternating)
return elif nodesDictionary[node].getColor() == 'Red': has_red = True explored.add(node) if node in edges_dict: adj_edges = edges_dict[node] for _to_node in adj_edges: to_node = _to_node.getName() if to_node not in explored: rec_bfs(to_node, t, has_red, set(explored)) rec_bfs(s, t, False, set()) nodesDictionary, edges, s, t, edges_dict = dataGen() max_edge = max_edges(len(nodesDictionary)) statusStep = max_edge // 2 print(statusStep) print_d("Setting up new starting & ending points") print_d("Setting up capacities and flows") print_d("RUN") # printNodeDictionary(nodesDictionary) # printEdges(edges) import signal
from Parser import dataGen nodesDictionary, edges, sourceNode, sinkNode, edges_dict = dataGen() print(len(nodesDictionary))