def main():
    G = get_graph.edge_list()  # read the input instance
    print_graph.input(G)
    k = int(input("Enter k:"))
    G, k, solution = kernel.kernelization(G, k)  # do kernelization
    print("Kernelization", k, solution)
    p3s = kernel.get_p3(G)
    if not three_way_branching(p3s, k, solution):
        print("No Solution")
    else:
        G.remove_nodes_from(sol)
        print_graph.output(G)
        print_graph.show()
def main():
    G = get_graph.edge_list()  # read the input instance
    print_graph.input(G)
    k = int(input("Enter k:"))
    d = int(input("Enter d:"))
    G, k, kernel_solution = kernel.kernelization(G, k)  # do kernelization
    print("Kernelization", k, kernel_solution)
    if not branching(G, [], k, d, []):
        print("No Solution")
    else:
        print("CVD solution: ", sol)
        G.remove_nodes_from(sol)
        print_graph.output(G)
        print_graph.show()
Exemple #3
0
def main():
	G=get_graph.edge_list()	# read the input instance
	print_graph.input(G)
	k=int(input("Enter k:"))
	G,k,kernel_solution=kernel.kernelization(G,k) # do kernelization
	print("Kernelization",k,kernel_solution)
	brute_solution=brute(G,k) # do brute force
	if k>0 and brute_solution == []:	
		print ("No Solution")
	else:
		solution=list(set(kernel_solution)|set(brute_solution)) # combine kernelization and brute force approach results
		print("CVD solution: ",solution)
		G.remove_nodes_from(solution)
		print_graph.output(G)
		print_graph.show()