This method is a standard implementation of Generate and Test . The argument n indicates the step of the path currently being built. The paint method draws the legs of the graph while a leg of the path is being taken or being erased. Calls FindPath to do the actual work of finding a Hamiltonian Path. Toggles the availability of individual links.
Users can help the search procedure by removing some links from the graph.
The link to be removed is selected from the supplied px, py values. If a link has been removed, then calling ToggleLinkStatus again on the same link puts the link back in service.