I'm trying to solve a slightly modified version of the problem. It has been modified in that the beginning and end points are given to us and rather than deciding that there is a solution, we want to find the number of solutions (which can be 0). The graph is given to us as a 2D array, with nodes having elements of array. Apart from this, we can move only horizontally or vertically, there is no need to say no more, we can not go from one city to two cities, because for that we need to come to the city twice. I have written a brute force solution that tries to all 4 (3 or 2 nodes) on all the nodes and takes possible steps on each node and then calculates the number of solutions ( Which occurs when it reaches the goal and sees all other nodes as well), but ran away for ridiculous amounts on the input of a modest size (i.e., a 7x7 array) I Also thought that since we know the target, Lake Do not use it really did not, because we do not want just to meet the fibers, we also have to make sure that visits all nodes. Apart from this, it may be that when all the nodes end between two edges, they are eliminated in a way that they can not join. I think there is something that I do not know that leaving me with only one brutal force solution. I know that this problem is NP-complete, but I am wondering if there is any improvement on the dead force. Has anyone given some more suggestions? - Edit - I mentioned that the use of bidirectional search really does not help and I want to make it clear why I thought so. Consider the 2x3 graph with the starting top and bottom right nodes of the target, respectively. Leave the edges of bidirectional search right and right from the beginning 2 After the move, all the nodes will have a tour, but there is no way to get involved in the fringe, because we can only go from one node to a node. However, it may be possible to work with algorithms in some modifications, as David had in his reply given below. , ... the only known way to determine whether the given normal graph has a Hamiltonian path, is to do a comprehensive search I believe that you want to start searching for the same Himalayan path, and then it is divided into two routes By Jit, dividing point which is clearly possible to distinguish two ways. So you can find permutations in subgroups (and residues, of course!) I do not know the exact algorithm, but this kind of division and winning method is where I will start.
Comments
Post a Comment